#######################################################################################
#######################################################################################
#NIDD_VER: MNL17A_1708_006_00
# MNL: MNL17A_1708_006
# Migration from MNL17A_1708_005 to MNL17A_1708_006
# 29.08.2017 John Villangca
#######################################################################################

#######################################################################################
#######################################################################################
# general version check

for_objects "MRBTS/MNL"
	begin
		if not ( get_version $current_dist_name ) == "MNL17A_1708_005"
			abort_file
		define "MNL_DN" $current_dist_name
	end
	
if ( objects_count "MRBTS/MNL" ) == 0
    abort_file
    
#######################################################################################
# add

define "CERTH_DN" MNL_DN JOIN "/CERTH-1"
add_object CERTH_DN
set_operation CERTH_DN "create"

for_objects "MRBTS/MNL/MNLENT"
	begin
		define "CERTHENT_DN" $current_dist_name JOIN "/CERTHENT-1"
		add_object CERTHENT_DN
		set_operation CERTHENT_DN "create"
	end

#######################################################################################
# update

for_objects "MRBTS/MNL/AMGR/LUAC"
	begin
		define "SBTS_LUAC_DN" $current_dist_name
		if ( param_exist $current_dist_name "localPasswdLastChangedTime" ) del_param $current_dist_name "localPasswdLastChangedTime"

		for_objects "MRBTS/LNBTS/FTM/AMGR/LUAC"
			begin
				if ( param_exist $current_dist_name "appAdmActivated" ) add_param SBTS_LUAC_DN "appAdmActivated" get_param $current_dist_name "appAdmActivated"
				if ( param_exist $current_dist_name "appAdmAlias" ) add_param SBTS_LUAC_DN "appAdmAlias" get_param $current_dist_name "appAdmAlias"
				if ( param_exist $current_dist_name "appAdmLocalPasswdLastChangedTime" ) add_param SBTS_LUAC_DN "appAdmLocalPasswdLastChangedTime" get_param $current_dist_name "appAdmLocalPasswdLastChangedTime"
				if ( param_exist $current_dist_name "appAdmPassword" ) add_param SBTS_LUAC_DN "appAdmPassword" get_param $current_dist_name "appAdmPassword"
				if ( param_exist $current_dist_name "password" ) add_param SBTS_LUAC_DN "password" get_param $current_dist_name "password"
				if ( param_exist $current_dist_name "readOnlyActivated" ) add_param SBTS_LUAC_DN "readOnlyActivated" get_param $current_dist_name "readOnlyActivated"
				if ( param_exist $current_dist_name "readOnlyAlias" ) add_param SBTS_LUAC_DN "readOnlyAlias" get_param $current_dist_name "readOnlyAlias"
				if ( param_exist $current_dist_name "readOnlyLocalPasswdLastChangedTime" ) add_param SBTS_LUAC_DN "readOnlyLocalPasswdLastChangedTime" get_param $current_dist_name "readOnlyLocalPasswdLastChangedTime"
				if ( param_exist $current_dist_name "readOnlyPassword" ) add_param SBTS_LUAC_DN "readOnlyPassword" get_param $current_dist_name "readOnlyPassword"
				if ( param_exist $current_dist_name "secAdmActivated" ) add_param SBTS_LUAC_DN "secAdmActivated" get_param $current_dist_name "secAdmActivated"
				if ( param_exist $current_dist_name "secAdmAlias" ) add_param SBTS_LUAC_DN "secAdmAlias" get_param $current_dist_name "secAdmAlias"
				if ( param_exist $current_dist_name "secAdmLocalPasswdLastChangedTime" ) add_param SBTS_LUAC_DN "secAdmLocalPasswdLastChangedTime" get_param $current_dist_name "secAdmLocalPasswdLastChangedTime"
				if ( param_exist $current_dist_name "secAdmPassword" ) add_param SBTS_LUAC_DN "secAdmPassword" get_param $current_dist_name "secAdmPassword"
				if ( param_exist $current_dist_name "userName" ) add_param SBTS_LUAC_DN "userName" get_param $current_dist_name "userName"
			end
	end

for_objects "MRBTS/MNL/MNLENT/CERTH"
	begin
		if ( param_exist $current_dist_name "cmpCrlSrcIpAddressDN" ) add_param CERTHENT_DN "cmpCrlSrcIpAddressDN" get_param $current_dist_name "cmpCrlSrcIpAddressDN"
	end

for_objects "MRBTS/MNL/MNLENT/CERTH/CMP"
	begin
		if ( param_exist $current_dist_name "state" ) del_param $current_dist_name "state"
		if not ( param_exist $current_dist_name "cmpPollingTimeout" ) add_param $current_dist_name "cmpPollingTimeout" "3600"
		copy_object $current_dist_name CERTH_DN JOIN "/CMP-1"
	end

for_objects "MRBTS/MNL/MNLENT/CERTH/CRLH"
	begin
		if ( param_exist $current_dist_name "state" ) del_param $current_dist_name "state"
		copy_object $current_dist_name CERTH_DN JOIN "/CRLH-1"
	end

for_objects "MRBTS/MNL/MNLENT/CERTH/CRLH/CRLDPCONFIG"
	begin
		copy_object $current_dist_name CERTH_DN JOIN "/CRLH-1/CRLDPCONFIG-" JOIN $current_CRLDPCONFIG
	end

for_objects "MRBTS/MNL/MNLENT/SECADM"
	begin
		if ( param_exist $current_dist_name "serviceAccountSshStatus" ) del_param $current_dist_name "serviceAccountSshStatus"
		if ( param_exist $current_dist_name "servicePortStatus" ) del_param $current_dist_name "servicePortStatus"
		if not ( param_exist $current_dist_name "sshClientAliveTimer" ) add_param $current_dist_name "sshClientAliveTimer" "45"
	end

for_objects "MRBTS/MNL/NOTES/NOTE"
	begin
		if ( param_exist $current_dist_name "describedObjDN" )
			begin
				add_param $current_dist_name "describedObject" get_param $current_dist_name "describedObjDN"
				del_param $current_dist_name "describedObjDN"
			end
	end

#######################################################################################
# delete

for_objects "MRBTS/MNL/MNLENT/CERTH" del_object $current_dist_name
for_objects "MRBTS/MNL/MNLENT/CERTH/CACERT" del_object $current_dist_name
for_objects "MRBTS/MNL/MNLENT/CERTH/CMP" del_object $current_dist_name
for_objects "MRBTS/MNL/MNLENT/CERTH/CRLH" del_object $current_dist_name
for_objects "MRBTS/MNL/MNLENT/CERTH/CRLH/CRLDPCONFIG" del_object $current_dist_name
for_objects "MRBTS/MNL/MNLENT/CERTH/CRLH/CRLINFO" del_object $current_dist_name
for_objects "MRBTS/MNL/MNLENT/CERTH/NECERT" del_object $current_dist_name

#######################################################################################
# Set proper versions and adaptations to MNL sub-tree

for_objects "MRBTS/MNL"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/AMGR"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/AMGR/LUAC"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/AMGR/LUAC/LUAC_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/CERTH"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/CERTH/CMP"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/CERTH/CRLH"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/CERTH/CRLH/CRLDPCONFIG"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/BBADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/CAPADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/CAPADM/CAPLIM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/CERTHENT"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/CERTHENT/CACERT_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/CERTHENT/CMP_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/CERTHENT/CRLH_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/CERTHENT/CRLINFO_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/CERTHENT/NECERT_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/DNS"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/FEATCADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end

for_objects "MRBTS/MNL/MNLENT/FEATCADM/FEATGADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end

for_objects "MRBTS/MNL/MNLENT/FEATCADM/FEATLADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end

for_objects "MRBTS/MNL/MNLENT/MPLANENW"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/PMCADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/PMMNL"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SECADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SECADM/SECADM_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
	
for_objects "MRBTS/MNL/MNLENT/SYNC"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK/CLOCK_FDD"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK/GNSSE"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK/NTP"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK/PDH"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK/SYNCE"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK/TOP"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK/TOP/TOPF"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	

for_objects "MRBTS/MNL/MNLENT/SYNC/CLOCK/TOP/TOPP"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/SYNC/TIME"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	

for_objects "MRBTS/MNL/MNLENT/TAC"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end		
	
for_objects "MRBTS/MNL/MNLENT/TAC/LTAC"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/TRBLCADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELC"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELC/CHANNELGROUP"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELC/CHANNELGROUP/CHANNEL"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELW"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELW/CHANNELGROUP"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELW/CHANNELGROUP/CHANNEL"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	

for_objects "MRBTS/MNL/MNLENT/FMCADM"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELL"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELL/CHANNELGROUP"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNLENT/CELLMAPPING/LCELL/CHANNELGROUP/CHANNEL"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
for_objects "MRBTS/MNL/NOTES"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	

for_objects "MRBTS/MNL/NOTES/NOTE"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end	
	
for_objects "MRBTS/MNL/MNL_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end

for_objects "MRBTS/MNL/CMD"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end

for_objects "MRBTS/MNL/MNLENT/TRBLCADM/TRBLCADM_R"
	begin
		set_version $current_dist_name "MNL17A_1708_006"
		set_adaptation $current_dist_name "com.nokia.srbts.mnl"
	end
