# WBTS17 to SBTS17 migration: MNL product

#NIDD_VER: MNL17_1701_004_00
# History
# v0.1 15.12.2016 Iosif SMEU: first draft for new CUTool

# define global constants
define "operation" "create"
define "version" "MNL17_1701_004"
define "adaptation" "com.nokia.srbts.mnl"

# abort rule-set in case of unexpected SCF version

if ( objects_count "WBTS/MRBTS" ) == 0 abort_file


for_objects "WBTS/MRBTS"
	begin
		define "oldMrbtsDn" $current_dist_name
		define "newMrbtsDn" "MRBTS-" JOIN $current_MRBTS
		for_objects "MRBTS/BTSSCW"
			if ( param_exist $current_dist_name "btsConfiguration" )
				if ( get_param $current_dist_name "btsConfiguration" ) >= 0 && ( get_param $current_dist_name "btsConfiguration" ) <= 1048575
					define "newMrbtsDn" "MRBTS-" JOIN get_param $current_dist_name "btsConfiguration"		
	end

if not ( ( get_version oldMrbtsDn ) == "WBTS17" || ( get_version oldMrbtsDn ) == "WBTS18" )
	abort_file

# MNL MOI set-up
for_objects "WBTS/MRBTS"
	begin
		# create new MOI
		define "mnlDn" newMrbtsDn JOIN "/MNL-1"
		add_object mnlDn
		set_operation mnlDn operation
		set_version mnlDn version
		set_adaptation mnlDn adaptation
		# add new (mandatory) parameters
		add_param mnlDn "validatePlanAgainstDetectedHW" "false"
	end

# AMGR MOI set-up
# create new MOI by copy from the old one if existing or from scratch otherwise
define "amgrDn" mnlDn JOIN "/AMGR-1"
if ( objects_count "AMGR" ) == 1
	for_objects "AMGR" copy_object $current_dist_name amgrDn
else
	add_object amgrDn
set_operation amgrDn operation
set_version amgrDn version
set_adaptation amgrDn adaptation
# add new (mandatory) parameters
add_param amgrDn "checkCnumPasswdExpiry" "false"
# rename (optional) parameters
if param_exist amgrDn "primaryLdapPort"
	begin
		del_param amgrDn "primaryLdapPort"
	end
if param_exist amgrDn "primaryLdapServer"
	begin
		del_param amgrDn "primaryLdapServer"
	end
if param_exist amgrDn "ldapConnectionType" del_param amgrDn "ldapConnectionType"

# LUAC MOI set-up
# create new MOI
define "luacDn" amgrDn JOIN "/LUAC-1"
add_object luacDn
set_operation luacDn operation
set_version luacDn version
set_adaptation luacDn adaptation
# add new (mandatory) parameters
add_param luacDn "btsAccountLockoutDuration" "15"
add_param luacDn "btsFailedLoginCountingPeriod" "5"
add_param luacDn "btsMaxFailedLoginAttempts" "5"
add_param luacDn "btsSessionLoginDelay" "1"
add_param luacDn "localPasswdExpiryPeriod" "0"
add_param luacDn "localPasswdWarningPeriod" "0"

# MNLENT MOI set-up
# create new MOI
define "mnlentDn" mnlDn JOIN "/MNLENT-1"
add_object mnlentDn
set_operation mnlentDn operation
set_version mnlentDn version
set_adaptation mnlentDn adaptation

# BBADM MOI set-up
# create new MOI
define "bbadmDn" mnlentDn JOIN "/BBADM-1"
add_object bbadmDn
set_operation bbadmDn operation
set_version bbadmDn version
set_adaptation bbadmDn adaptation

# CAPADM MOI set-up
# create new MOI
define "capadmDn" mnlentDn JOIN "/CAPADM-1"
add_object capadmDn
set_operation capadmDn operation
set_version capadmDn version
set_adaptation capadmDn adaptation

# CELLMAPPING MOI set-up
# create new MOI
define "cellmappingDn" mnlentDn JOIN "/CELLMAPPING-1"
add_object cellmappingDn
set_operation cellmappingDn operation
set_version cellmappingDn version
set_adaptation cellmappingDn adaptation

# LCELW / CHANNELGROUP / CHANNEL MOIs set-up based on WNCEL / old LCELW MOIs
for_objects "MRBTS/WNBTS/WNCEL"
	begin
		# create new LCELW MOI from WNCEL/lCelwDN
		define "lcelwDn" get_param $current_dist_name "lCelwDN"
		add_object lcelwDn
		set_operation lcelwDn operation
		set_version lcelwDn version
		set_adaptation lcelwDn adaptation
		# create CHANNELGROUP MOI from scratch
		define "chgrDn" lcelwDn JOIN "/CHANNELGROUP-1"
		add_object chgrDn
		set_operation chgrDn operation
		set_version chgrDn version
		set_adaptation chgrDn adaptation
		# create CHANNEL MOIs from old LCELW/resourceList
		define "oldLcelwDn" oldMrbtsDn JOIN "/BTSSCW-1/LCELW-" JOIN $current_WNCEL
		for_list oldLcelwDn "resourceList"
			begin
				define "txRxUsage" get_param oldLcelwDn "resourceList." JOIN $current_index JOIN ".txRxUsage"
				if txRxUsage == "TXRX"
					define "direction" "TX"
				else
					define "direction" txRxUsage
				define "chDn" chgrDn JOIN "/CHANNEL-" JOIN ( ( objects_count chgrDn JOIN "/CHANNEL" ) + 1 )
				add_object chDn
				set_operation chDn operation
				set_version chDn version
				set_adaptation chDn adaptation
				add_param chDn "direction" direction
				for_objects "RMOD/ANTL"
					if ( get_param oldLcelwDn "resourceList." JOIN $current_index JOIN ".antlId" ) == $current_ANTL
						begin
							define "antlDN" $current_dist_name
							add_param chDn "antlDN" antlDN
							for_objects "LOGLINK"
								begin
									define "secondEndpointDN" get_param $current_dist_name "secondEndpointDN"
									if ( get_param $current_dist_name "firstEndpointDN" ) == antlDN && ( replace secondEndpointDN "MRBTS-\d+/EQM-\d+/APEQM-\d+/PHYANT-\d+/PHYANTU-\d+" "" flags "g" ) == ""
										add_param chDn "phyAntUDN" secondEndpointDN
								end
						end
				if txRxUsage == "TXRX"
					begin
						define "chnDn" chgrDn JOIN "/CHANNEL-" JOIN ( ( objects_count chgrDn JOIN "/CHANNEL" ) + 1 )
						copy_object chDn chnDn
						set_operation chnDn operation
						set_version chnDn version
						set_adaptation chnDn adaptation
						add_param chnDn "direction" "RX"
					end
			end
	end

# CERTH MOI set-up
# create new MOI
define "certhDn" mnlentDn JOIN "/CERTH-1"
add_object certhDn
set_operation certhDn operation
set_version certhDn version
set_adaptation certhDn adaptation
# add (mandatory) parameters
add_param certhDn "cmpCrlSrcIpAddressDN" ""

# CMP MOI set-up
# create new MOI
define "cmpDn" certhDn JOIN "/CMP-1"
add_object cmpDn
set_operation cmpDn operation
set_version cmpDn version
set_adaptation cmpDn adaptation
# add (mandatory/optional) parameters
for_objects "FTM/CERTH"
	begin
		if param_exist $current_dist_name "caCertificateUpdateTime" add_param cmpDn "caCertificateUpdateTime" get_param $current_dist_name "caCertificateUpdateTime"
		if param_exist $current_dist_name "caSubjectName" add_param cmpDn "caSubjectName" get_param $current_dist_name "caSubjectName"
		if param_exist $current_dist_name "btsCertificateUpdateTime" add_param cmpDn "neCertificateUpdateTime" get_param $current_dist_name "btsCertificateUpdateTime"
		if param_exist $current_dist_name "cmpServerIpAddress" add_param cmpDn "serverHost" get_param $current_dist_name "cmpServerIpAddress"
		if param_exist $current_dist_name "cmpDirectory" add_param cmpDn "serverPath" get_param $current_dist_name "cmpDirectory"
		if param_exist $current_dist_name "cmpServerPort" add_param cmpDn "serverPort" get_param $current_dist_name "cmpServerPort"
	end

# CRLH MOI set-up
# create new MOI
define "crlhDn" certhDn JOIN "/CRLH-1"
add_object crlhDn
set_operation crlhDn operation
set_version crlhDn version
set_adaptation crlhDn adaptation
# add (mandatory) parameters
for_objects "FTM/CERTH"
	begin
		if param_exist $current_dist_name "CRLDPSource" add_param crlhDn "distributionPointSource" get_param $current_dist_name "CRLDPSource"
		if param_exist $current_dist_name "crlUpdatePeriod" add_param crlhDn "updatePeriod" get_param $current_dist_name "crlUpdatePeriod"
		if param_exist $current_dist_name "CRLUsageEnabled" add_param crlhDn "usageEnabled" get_param $current_dist_name "CRLUsageEnabled"
	end

# CRLDPCONFIG MOI set-up
for_objects "FTM/CERTH"
	for_list $current_dist_name "CRLDistributionPoint"
		begin
			# create new MOI
			define "crldpconfigDn" crlhDn JOIN "/CRLDPCONFIG-" JOIN ( $current_index + 1 )
			add_object crldpconfigDn
			set_operation crldpconfigDn operation
			set_version crldpconfigDn version
			set_adaptation crldpconfigDn adaptation
			# add (mandatory/optional) parameters
			if param_exist $current_dist_name "CRLDistributionPoint." JOIN $current_index JOIN ".CRLDPPrimary" add_param crldpconfigDn "primaryCRLDP" get_param $current_dist_name "CRLDistributionPoint." JOIN $current_index JOIN ".CRLDPPrimary"
			if param_exist $current_dist_name "CRLDistributionPoint." JOIN $current_index JOIN ".CRLDPSecondary" add_param crldpconfigDn "secondaryCRLDP" get_param $current_dist_name "CRLDistributionPoint." JOIN $current_index JOIN ".CRLDPSecondary"
		end

# DNS MOI set-up
for_objects "FTM/IPNO/IDNS"
	begin
        if ( param_exist $current_dist_name "serverIpAddress" ) && ( ( get_param $current_dist_name "serverIpAddress" )  != "0.0.0.0" )
            begin
                define "dnsDn" mnlentDn JOIN "/DNS-" JOIN $current_IDNS

                add_object dnsDn
                set_operation dnsDn operation
                set_version dnsDn version
                set_adaptation dnsDn adaptation

				add_param dnsDn "serverIpAddressPrimary" get_param $current_dist_name "serverIpAddress"

				if ( param_exist $current_dist_name "serverIpAddress2" )
                    begin
                        if ( get_param $current_dist_name "serverIpAddress2" ) != ( get_param $current_dist_name "serverIpAddress" )
                            begin
                                add_param dnsDn "serverIpAddressSecondary" get_param $current_dist_name "serverIpAddress2"
                            end
                    end
            end
	end

# FEATCADM MOI set-up
# create new MOI
define "featcadmDn" mnlentDn JOIN "/FEATCADM-1"
add_object featcadmDn
set_operation featcadmDn operation
set_version featcadmDn version
set_adaptation featcadmDn adaptation
# add (mandatory) parameters
for_objects "MRBTS/BTSSCW"
	begin
		add_param featcadmDn "actAldSwUpdate" "false"
		if param_exist $current_dist_name "aldSwDownloadEnabled"
			add_param featcadmDn "actAldSwUpdate" get_param $current_dist_name "aldSwDownloadEnabled"
		add_param featcadmDn "actDtPim" "false"
		add_param featcadmDn "actMhaAutoConfig" "false"
		add_param featcadmDn "actPimTesting" "false"
		if param_exist $current_dist_name "actPimTesting"
			add_param featcadmDn "actPimTesting" get_param $current_dist_name "actPimTesting"
		add_param featcadmDn "actPowerMeter" "false"
		if param_exist $current_dist_name "powerMeterEnabled"
			add_param featcadmDn "actPowerMeter" get_param $current_dist_name "powerMeterEnabled"
		add_param featcadmDn "actRemoteRfDiag" "false"
		add_param featcadmDn "actRfiTesting" "false"
		if param_exist $current_dist_name "actRfiTesting"
			add_param featcadmDn "actRfiTesting" get_param $current_dist_name "actRfiTesting"		
		add_param featcadmDn "actRxMonitoring" "true"
		if param_exist $current_dist_name "antRxLevelMonitoringEnabled"
			add_param featcadmDn "actRxMonitoring" get_param $current_dist_name "antRxLevelMonitoringEnabled"
		add_param featcadmDn "rfSharingEnabled" "false"
		if param_exist $current_dist_name "rfSharingEnabled"
			add_param featcadmDn "rfSharingEnabled" get_param $current_dist_name "rfSharingEnabled"
	end
for_objects "FTM/IPNO"
	if param_exist $current_dist_name "enableTransportConfigFallback"
		add_param featcadmDn "actTransportConfigFallback" get_param $current_dist_name "enableTransportConfigFallback"
	else
		add_param featcadmDn "actTransportConfigFallback" "false"

# FMCADM MOI set-up
# create new MOI
define "fmcadmDn" mnlentDn JOIN "/FMCADM-1"
add_object fmcadmDn
set_operation fmcadmDn operation
set_version fmcadmDn version
set_adaptation fmcadmDn adaptation
# add (mandatory) parameters
add_param fmcadmDn "actCategoryAlarms" "false"
add_param fmcadmDn "actForceAutoReset" "false"
add_param fmcadmDn "actForceUnitAutoReset" "false"

# MPLANENW MOI set-up
# create new MOI
define "mplanewDn" mnlentDn JOIN "/MPLANENW-1"
add_object mplanewDn
set_operation mplanewDn operation
set_version mplanewDn version
set_adaptation mplanewDn adaptation
# add (mandatory/optional) parameters
for_objects "FTM/IPNO/QOS"
	for_list $current_dist_name "trafficTypesMap"
		if ( get_param $current_dist_name "trafficTypesMap." JOIN $current_index JOIN ".trafficType" ) == "DCN"
			add_param mplanewDn "mPlaneDscp" get_param $current_dist_name "trafficTypesMap." JOIN $current_index JOIN ".dscpList"
for_objects "FTM/IPNO"
	begin
		define "oldIpnoDn" $current_dist_name

		if param_exist oldIpnoDn "mPlaneIpAddress"
			for_objects "MRBTS/TNLSVC/TNL/IPNO/IPIF/IPADDRESSV4"
				if ( get_param oldIpnoDn "mPlaneIpAddress" ) == ( get_param $current_dist_name "localIpAddr" )
					add_param mplanewDn "mPlaneIpAddressDN" $current_dist_name

        if param_exist oldIpnoDn "omsTls"
            begin
                define "omsTls" get_param oldIpnoDn "omsTls"

                if ( omsTls ) == "off"
                    define "oamTls" "off"

                if ( omsTls ) == "forced" || ( omsTls ) == "probing"
                    define "oamTls" "forced"

                add_param mplanewDn "oamTls" oamTls
            end
	end

add_param mplanewDn "tlsRenegotiationInterval" "86400"
define "oamPeerIpAddress" "0.0.0.0"
for_objects "FTM/IPNO/IDNS"
	if ( param_exist $current_dist_name "serverIpAddress2" )
		if ( replace get_param $current_dist_name "serverIpAddress2" "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" "" flags "g" ) == ""
			define "oamPeerIpAddress" get_param $current_dist_name "serverIpAddress2"
add_param mplanewDn "oamPeerIpAddress" oamPeerIpAddress

# SECADM MOI set-up
# create new MOI
define "secadmDn" mnlentDn JOIN "/SECADM-1"
add_object secadmDn
set_operation secadmDn operation
set_version secadmDn version
set_adaptation secadmDn adaptation
# add (mandatory) parameters
add_param secadmDn "actServiceAccountSsh" "false"
add_param secadmDn "actServicePortState" "false"
for_objects "MRBTS/BTSSCW"
	if param_exist $current_dist_name "actEthernetSec"
		add_param secadmDn "ethernetPortSecurityEnabled" get_param $current_dist_name "actEthernetSec"
	else
		add_param secadmDn "ethernetPortSecurityEnabled" "true"
add_param secadmDn "passwdHistoryLength" "0"
add_param secadmDn "sshClientAliveTimer" "45"
add_param secadmDn "sshSessionLoginDelayTimer" "10"

# SYNC MOI set-up
# create new MOI
define "syncDn" mnlentDn JOIN "/SYNC-1"
add_object syncDn
set_operation syncDn operation
set_version syncDn version
set_adaptation syncDn adaptation
# add (mandatory) parameters
for_objects "MRBTS/BTSSCW"
	if param_exist $current_dist_name "btsSyncMode"
		add_param syncDn "btsSyncMode" get_param $current_dist_name "btsSyncMode"
	else
		add_param syncDn "btsSyncMode" "FreqSync"
add_param syncDn "manualFrameTimingAdjustment" "0"

# CLOCK MOI set-up
# create new MOI
for_objects "MRBTS/SMOD"
	begin
		define "syncInputListIndex" 0
		define "syncInputPrio" 0
		define "clockDn" syncDn JOIN "/CLOCK-" JOIN $current_SMOD
		add_object clockDn
		set_operation clockDn operation
		set_version clockDn version
		set_adaptation clockDn adaptation
		# add (mandatory/optional) parameters
		for_objects "MRBTS/BTSSCW"
			begin
				if param_exist $current_dist_name "btsSyncMode"
					add_param clockDn "holdOverModeUsed" get_param $current_dist_name "holdOverModeUsed"
				else
					add_param clockDn "holdOverModeUsed" "false"
				add_param clockDn "outputConfiguration1Pps" "Disabled"
				if ( get_param $current_dist_name "syncPropagationEnabled" ) == "false"
					add_param clockDn "outputConfiguration1Pps" "Disabled"
				else if ( get_param $current_dist_name "syncPropagationEnabled" ) == "true"
					begin
						if ( get_param $current_dist_name "ext1ppsClkOutOn" ) == "false"
							add_param clockDn "outputConfiguration1Pps" "EnabledWithBtsInputReference"
						else if ( get_param $current_dist_name "ext1ppsClkOutOn" ) == "true"
							add_param clockDn "outputConfiguration1Pps" "EnabledWithoutBtsInputReference"
					end
				add_param clockDn "outputConfiguration2M048" "Disabled"
				if ( get_param $current_dist_name "syncPropagationEnabled" ) == "false"
					add_param clockDn "outputConfiguration2M048" "Disabled"
				else if ( get_param $current_dist_name "syncPropagationEnabled" ) == "true"
					begin
						if ( get_param $current_dist_name "ext2M048ClkOutOn" ) == "false"
							add_param clockDn "outputConfiguration2M048" "EnabledWithBtsInputReference"
						else if ( get_param $current_dist_name "ext2M048ClkOutOn" ) == "true"
							add_param clockDn "outputConfiguration2M048" "EnabledWithoutBtsInputReference"
					end
			end
		for_objects "MRBTS/EQM/APEQM/CABINET-" JOIN $current_SMOD JOIN "/SMOD-1"
			add_param clockDn "sModDN" $current_dist_name
		# GNSSE MOI set-up
		for_objects "MRBTS/BTSSCW"
			if ( get_param $current_dist_name "gpsInUse" ) == "true"
				begin
					# create new MOI
					define "gnsseDn" clockDn JOIN "/GNSSE-1"
					add_object gnsseDn
					set_operation gnsseDn operation
					set_version gnsseDn version
					set_adaptation gnsseDn adaptation
					# add (mandatory) parameters
					add_param gnsseDn "actGnssOutputLnaPowerSupply" "true"
					add_param gnsseDn "gnssControlMode" "GPS-GLONASS"
					if ( get_param $current_dist_name "btsSyncMode" ) == "PhaseSync"
						if param_exist $current_dist_name "gpsTotalAntennaLineDelay" add_param gnsseDn "gnssLineDelay" get_param $current_dist_name "gpsTotalAntennaLineDelay"
						else if param_exist $current_dist_name "gpsCableLength" add_param gnsseDn "gnssCableLength" get_param $current_dist_name "gpsCableLength"
					if param_exist $current_dist_name "holdOverModeUsed" add_param gnsseDn "gnssReceiverHoldoverMode" get_param $current_dist_name "holdOverModeUsed"
					add_param gnsseDn "locationMode" "automatic"
					# add corresponding CLOCK.syncInputList entry
					if not param_exist clockDn "syncInputList" add_list clockDn "syncInputList"
					add_complex_param clockDn "syncInputList." JOIN syncInputListIndex
					define "syncInputPrio" syncInputPrio + 1
					add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputPrio" syncInputPrio
					add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputType" "1pps/ToD from external GNSS receiver"
					define "syncInputListIndex" syncInputListIndex + 1
				end
			else if ( get_param $current_dist_name "gpsCtrlBlockForCoLocatedBts" ) == "true"
				begin
					if param_exist $current_dist_name "gpsTotalAntennaLineDelay"
						add_param clockDn "totalDelayFromSHM" get_param $current_dist_name "gpsTotalAntennaLineDelay"
					# add corresponding CLOCK.syncInputList entry
					if not param_exist clockDn "syncInputList" add_list clockDn "syncInputList"
					add_complex_param clockDn "syncInputList." JOIN syncInputListIndex
					define "syncInputPrio" syncInputPrio + 1
					add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputPrio" syncInputPrio
					add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputType" "1pps/ToD from Sync Hub Master"
					define "syncInputListIndex" syncInputListIndex + 1
				end
		# NTP MOI set-up
		# create new MOI
		define "ntpDn" clockDn JOIN "/NTP-1"
		add_object ntpDn
		set_operation ntpDn operation
		set_version ntpDn version
		set_adaptation ntpDn adaptation
		# add (optional) parameters
		for_objects "FTM/IPNO/INTP"
			copy_list $current_dist_name "ntpServers" ntpDn "ntpServerIpAddrList"
		for_objects "FTM/SYNC/STPG"
			begin
				define "stpgDn" $current_dist_name
				define "synceIndex" 0
				define "counter" 1

				for_list stpgDn "synchroSourceList"
					begin
						define "synchroSourceListIndex" $current_index
						if ( get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".clockProtocol" ) == "clkPDH"
							begin
								# PDH MOI set-up
								# create new MOI
								define "interfaceNumber" get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".interfaceNumber"
								
								define "pdhDn" clockDn JOIN "/PDH-" JOIN counter
								add_object pdhDn
								set_operation pdhDn operation
								set_version pdhDn version
								set_adaptation pdhDn adaptation
								# add (optional) parameters
								for_objects "TNLSVC/TNL/PPTT"
									if interfaceNumber == $current_PPTT
										add_param pdhDn "ppttDN" $current_dist_name
								# add corresponding CLOCK.syncInputList entry
								if not param_exist clockDn "syncInputList" add_list clockDn "syncInputList"
								add_complex_param clockDn "syncInputList." JOIN syncInputListIndex
								if param_exist stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".priority"
									add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputPrio" ( get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".priority" ) + syncInputPrio
								add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputType" "PDH-" JOIN counter
								define "syncInputListIndex" syncInputListIndex + 1
								define "counter" counter + 1

							end
						if ( get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".clockProtocol" ) == "clkSyncE"
							begin
								# SYNCE MOI set-up
								# create new MOI
								define "synceIndex" synceIndex + 1
								define "synceDn" clockDn JOIN "/SYNCE-" JOIN synceIndex
								add_object synceDn
								set_operation synceDn operation
								set_version synceDn version
								set_adaptation synceDn adaptation
								# add (optional) parameters
								for_objects "TNLSVC/TNL/ETHSVC/ETHLK"
									if ( get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".unitNumber" ) == "0" || ( get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".unitNumber" ) == "1"
										begin
											if ( replace get_param $current_dist_name "modDN" "TRSMOD" "" ) == ( get_param $current_dist_name "modDN" ) && ( get_param $current_dist_name "connectorLabel" ) == "EIF" JOIN get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".interfaceNumber"
												add_param synceDn "ethlkDN" $current_dist_name
										end
									else
										begin
											if ( replace get_param $current_dist_name "modDN" "TRSMOD" "" ) != ( get_param $current_dist_name "modDN" ) && ( get_param $current_dist_name "connectorLabel" ) == "EIF" JOIN get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".interfaceNumber"
												add_param synceDn "ethlkDN" $current_dist_name
										end
								if param_exist stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".ssmAcceptanceLevel"
									begin
										define "ssmAcceptanceLevel" get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".ssmAcceptanceLevel"
										if ssmAcceptanceLevel == "ssmSSU"
											define "ssmAcceptanceLevel" "ssmSSUorST2"
										add_param synceDn "ssmAcceptanceLevel" ssmAcceptanceLevel
									end
								if param_exist stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".ssmEnabled"
									add_param synceDn "ssmEnabled" get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".ssmEnabled"
								if param_exist stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".ssmTimeout"
									add_param synceDn "ssmTimeout" get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".ssmTimeout"
								# add corresponding CLOCK.syncInputList entry
								if not param_exist clockDn "syncInputList" add_list clockDn "syncInputList"
								add_complex_param clockDn "syncInputList." JOIN syncInputListIndex
								if param_exist stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".priority"
									add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputPrio" ( get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".priority" ) + syncInputPrio
								add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputType" "SYNCE-" JOIN synceIndex
								define "syncInputListIndex" syncInputListIndex + 1
							end
						if ( get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".clockProtocol" ) == "clkToP"
							begin
								# TOP MOI set-up
								# create new MOI
								define "topDn" clockDn JOIN "/TOP-1"
								add_object topDn
								set_operation topDn operation
								set_version topDn version
								set_adaptation topDn adaptation
								# add (optional) parameters
								for_objects "FTM/IPNO/QOS"
									for_list $current_dist_name "trafficTypesMap"
										if ( get_param $current_dist_name "trafficTypesMap." JOIN $current_index JOIN ".trafficType" ) == "TOP"
											add_param topDn "sPlaneDscp" get_param $current_dist_name "trafficTypesMap." JOIN $current_index JOIN ".dscpList"
								for_objects "FTM/IPNO"
									begin
										define "sPlaneIpAddress" get_param $current_dist_name "sPlaneIpAddress"
										for_objects "MRBTS/TNLSVC/TNL/IPNO/IPIF/IPADDRESSV4"
											if ( get_param $current_dist_name "localIpAddr" ) == sPlaneIpAddress
												add_param topDn "sPlaneIpAddressDN" $current_dist_name
									end
								for_objects "FTM/TOPB/TOPF"
									if param_exist $current_dist_name "topDomainNumber"
										add_param topDn "topDomainNumber" get_param $current_dist_name "topDomainNumber"
								# TOPF MOI set-up
								for_objects "MRBTS/BTSSCW"
									if ( get_param $current_dist_name "btsSyncMode" ) == "FreqSync"
										begin
											# create new MOI
											define "topfDn" topDn JOIN "/TOPF-1"
											add_object topfDn
											set_operation topfDn operation
											set_version topfDn version
											set_adaptation topfDn adaptation
											# add (mandatory/optional) parameters
											for_objects "FTM/TOPB/TOPF"
												begin
													if param_exist $current_dist_name "acceptedClockQuality"
														copy_list $current_dist_name "acceptedClockQuality" topfDn "acceptedClockClass"
													if param_exist $current_dist_name "announceRequestMode"
														add_param topfDn "announceRequestMode" get_param $current_dist_name "announceRequestMode"
													if param_exist $current_dist_name "ieeeTelecomProfile"
														add_param topfDn "ieeeTelecomProfile" get_param $current_dist_name "ieeeTelecomProfile"
													if param_exist $current_dist_name "logMeanSyncValue"
														begin
															define "logMeanSyncValue" get_param $current_dist_name "logMeanSyncValue"
															if logMeanSyncValue == "-3" define "syncMessageRate" "RATE_8"
															if logMeanSyncValue == "-4" define "syncMessageRate" "RATE_16"
															if logMeanSyncValue == "-5" define "syncMessageRate" "RATE_32"
															add_param topfDn "syncMessageRate" syncMessageRate
														end
													if param_exist $current_dist_name "topMasters"
														begin
															add_list topfDn "topMasterList"
															for_list $current_dist_name "topMasters"
																begin
																	add_complex_param topfDn "topMasterList." JOIN $current_index
																	add_param topfDn "topMasterList." JOIN $current_index JOIN ".masterIpAddr" get_param $current_dist_name "topMasters." JOIN $current_index JOIN ".masterIpAddr"
																	add_param topfDn "topMasterList." JOIN $current_index JOIN ".priority_1" get_param $current_dist_name "topMasters." JOIN $current_index JOIN ".priority_1"
																	add_param topfDn "topMasterList." JOIN $current_index JOIN ".priority_2" get_param $current_dist_name "topMasters." JOIN $current_index JOIN ".priority_2"
																end
														end
												end
											# add corresponding CLOCK.syncInputList entry
											if not param_exist clockDn "syncInputList" add_list clockDn "syncInputList"
											add_complex_param clockDn "syncInputList." JOIN syncInputListIndex
											if param_exist stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".priority"
												add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputPrio" ( get_param stpgDn "synchroSourceList." JOIN synchroSourceListIndex JOIN ".priority" ) + syncInputPrio
											add_param clockDn "syncInputList." JOIN syncInputListIndex JOIN ".syncInputType" "TOPF"
											define "syncInputListIndex" syncInputListIndex + 1
										end
							end
					end
			end
	end

# TIME MOI set-up
# create new MOI
define "timeDn" syncDn JOIN "/TIME-1"
add_object timeDn
set_operation timeDn operation
set_version timeDn version
set_adaptation timeDn adaptation
# add (mandatory) parameters
add_param timeDn "timeZone" get_param oldMrbtsDn "timeZone"

# TRBLCADM MOI set-up
# create new MOI
define "trblcadmDn" mnlentDn JOIN "/TRBLCADM-1"
add_object trblcadmDn
set_operation trblcadmDn operation
set_version trblcadmDn version
set_adaptation trblcadmDn adaptation
# add (mandatory/optional) parameters
add_param trblcadmDn "actCoreDumpFileCollection" "true"
add_param trblcadmDn "actRemoteSyslogTransmission" "false"
for_objects "WBTS/MRBTS"
	for_list $current_dist_name "symptomDataTriggerL"
		begin
			if not param_exist trblcadmDn "faultSnapshotTriggers"
				add_list trblcadmDn "faultSnapshotTriggers"
			add_complex_param trblcadmDn "faultSnapshotTriggers." JOIN $current_index
			add_param trblcadmDn "faultSnapshotTriggers." JOIN $current_index JOIN ".triggerType" "onFaultDetection"
			add_param trblcadmDn "faultSnapshotTriggers." JOIN $current_index JOIN ".faultNumber" get_param $current_dist_name "symptomDataTriggerL." JOIN $current_index JOIN ".faultId"
		end
#add_list trblcadmDn "remoteSyslogConfig"
#add_complex_param trblcadmDn "remoteSyslogConfig.0"
#add_param trblcadmDn "remoteSyslogConfig.0.remoteSyslogDSCP" "0"
#add_param trblcadmDn "remoteSyslogConfig.0.remoteSyslogFormat" "RFC5424"
#add_param trblcadmDn "remoteSyslogConfig.0.remoteSyslogServerIPaddress" "0.0.0.0"
#add_param trblcadmDn "remoteSyslogConfig.0.remoteSyslogServerPortNo" "6514"
#add_param trblcadmDn "remoteSyslogConfig.0.remoteSyslogTransmitDuration" "240"
#add_param trblcadmDn "remoteSyslogConfig.0.remoteSyslogTransportProtocol" "TLS"
