#######################################################################################
#######################################################################################
#NIDD_VER: TNL17A_1708_007_00
# TNL: TNL17A_1708_007
# delta from TNL17A_1708_006 to TNL17A_1708_007
# 21.10.2017 Sebastian Kulikowski
#######################################################################################

#######################################################################################
#######################################################################################
# Check if ruleset should be executed

for_objects "MRBTS/TNLSVC"
    begin
        if not ( get_version $current_dist_name ) == "TNL17A_1708_006"
            abort_file
    end

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

define "tnlDn" ""
for_objects "MRBTS/TNLSVC/TNL"
    begin
        define "tnlDn" $current_dist_name
    end

if ( objects_count "SBTS/BTSSCW" ) == 1
    begin
        define "ipappDn" tnlDn JOIN "/IPAPP-1"
        if ( objects_count ipappDn ) == 0
            begin
                add_object ipappDn
                set_operation ipappDn "create"
                set_adaptation ipappDn "com.nokia.srbts.tnl"
            end

        define "fpmuxDn" ipappDn JOIN "/FPMUX-1"
        if ( objects_count fpmuxDn ) == 0
            begin
                add_object fpmuxDn
                set_operation fpmuxDn "create"
                set_adaptation fpmuxDn "com.nokia.srbts.tnl"
                set_version fpmuxDn "TNL17A_1708_007"

                add_param fpmuxDn "udpMuxAmount" 30
                add_param fpmuxDn "udpMuxDelay" 2
                add_param fpmuxDn "udpPortLocal" 65534
                add_param fpmuxDn "udpPortRemote" 65535
            end
    end

for_objects "MRBTS/TNLSVC/TNL/IPNO/QOS/FLOWCL"
    begin
        define "flowClDn" $current_dist_name
        if ( param_exist flowClDn "ruleSet.0.fstSchDN" )
            begin
                define "fstSchDN" get_param flowClDn "ruleSet.0.fstSchDN"
                if ( objects_count fstSchDN ) == 1
                    begin
                        if ( param_exist fstSchDN "ipIfDN" )
                            begin
                                del_param fstSchDN "ipIfDN"
                            end
                    end
            end
    end

for_objects "MRBTS/TNLSVC/TNL/IPAPP/IPSECC"
    begin
        define "ipseccDn" $current_dist_name
        if ( param_exist ipseccDn "ipSecEmBypassCtrlIpAddr" )
            begin
                define "ipSecEmBypassCtrlIpAddr" get_param ipseccDn "ipSecEmBypassCtrlIpAddr"
                if ( ipSecEmBypassCtrlIpAddr ) == "0.0.0.0"
                    del_param ipseccDn "ipSecEmBypassCtrlIpAddr"
            end
    end

for_objects "MRBTS/TNLSVC/TNL/PMTNL"
	begin
        if not ( param_exist $current_dist_name "bridgePortStatisticsInterval" )
            begin
                add_param $current_dist_name "bridgePortStatisticsInterval" "disabled"
            end

        if not ( param_exist $current_dist_name "ethernetInterfaceStatisticsInterval" )
            begin
                add_param $current_dist_name "ethernetInterfaceStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "ethernetLinkInterval" )
            begin
                add_param $current_dist_name "ethernetLinkInterval" "15min"
            end

        if not ( param_exist $current_dist_name "firstLevelSchedulerStatisticsInterval" )
            begin
                add_param $current_dist_name "firstLevelSchedulerStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "iComGwLookupErrStatInterval" )
            begin
                add_param $current_dist_name "iComGwLookupErrStatInterval" "15min"
            end

        if not ( param_exist $current_dist_name "ipFilteringInterval" )
            begin
                add_param $current_dist_name "ipFilteringInterval" "15min"
            end

        if not ( param_exist $current_dist_name "ipInterfaceStatisticsInterval" )
            begin
                add_param $current_dist_name "ipInterfaceStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "ipPerHopBehaviourStatisticsInterval" )
            begin
                add_param $current_dist_name "ipPerHopBehaviourStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "ipSecSaStatisticsInterval" )
            begin
                add_param $current_dist_name "ipSecSaStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "ipSecStatisticsInterval" )
            begin
                add_param $current_dist_name "ipSecStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "ipV4AddressStatisticsInterval" )
            begin
                add_param $current_dist_name "ipV4AddressStatisticsInterval" "disabled"
            end

        if not ( param_exist $current_dist_name "ipV6AddressStatisticsInterval" )
            begin
                add_param $current_dist_name "ipV6AddressStatisticsInterval" "disabled"
            end

        if not ( param_exist $current_dist_name "ipV6InterfaceStatisticsInterval" )
            begin
                add_param $current_dist_name "ipV6InterfaceStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "ipV6PerHopBehaviourStatisticsInterval" )
            begin
                add_param $current_dist_name "ipV6PerHopBehaviourStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "pdhInterfaceStatisticsInterval" )
            begin
                add_param $current_dist_name "pdhInterfaceStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "pppLinkStatisticsInterval" )
            begin
                add_param $current_dist_name "pppLinkStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "pppMultiLinkStatisticsInterval" )
            begin
                add_param $current_dist_name "pppMultiLinkStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "pppSingleLinkStatisticsInterval" )
            begin
                add_param $current_dist_name "pppSingleLinkStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "sctpStatisticsInterval" )
            begin
                add_param $current_dist_name "sctpStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "secondLevelSchedulerStatisticsInterval" )
            begin
                add_param $current_dist_name "secondLevelSchedulerStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "tcpUdpStatisticsInterval" )
            begin
                add_param $current_dist_name "tcpUdpStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "twampStatisticsInterval" )
            begin
                add_param $current_dist_name "twampStatisticsInterval" "15min"
            end

        if not ( param_exist $current_dist_name "vlanStatisticsInterval" )
            begin
                add_param $current_dist_name "vlanStatisticsInterval" "15min"
            end
    end

for_objects "TNLSVC/TNL/IPAPP/IPSECC/IKEP"
    begin
        define "ikepDn" $current_dist_name

        if ( param_exist ikepDn "ikeMaxLifeTime" )
            begin
                define "ikeMaxLifeTime" get_param ikepDn "ikeMaxLifeTime"

                if ( ikeMaxLifeTime ) > 86400
                    begin
                        add_param ikepDn "ikeMaxLifeTime" 86400
                    end
            end
    end

#######################################################################################
# update version
	
for_objects "VLANID2QMAP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end

for_objects "TWAMPREFLECT"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end

for_objects "TNL"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end

for_objects "TNLSVC"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
	
for_objects "ETHSVC"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end

for_objects "ETHIF"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "VLANIF"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "ETHLK"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "L2SWI"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "BRGPRT"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IBRGPRT"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "DSCPTOQMAP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "PCP2QMAP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "FRLI"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPAPP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "BFD"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "BFDGRP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPSECC"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
	
for_objects "IKEP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IKEPROTGRP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IKEPSWITCHREQ"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPSECP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "SECPOL"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "TWAMP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPNO"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPIF"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPADDRESSV4"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPADDRESSV6"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPRT"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "IPRTV6"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "MCAPP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "QOS"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "DSCP2PCPMAP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "DSCP2QMAP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "FLOWCL"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "FSTSCH"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "RTPOL"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "P3LP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "P3ML"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "DSCP2MC2MAP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "DSCP2MC4MAP"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "P3SL"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "PMTNL"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "PPTT"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
		
for_objects "TRIGGER"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end

for_objects "FPMUX"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end

for_objects "MRBTS/TNLSVC/TNL/PMTNL"
	begin
		set_version $current_dist_name "TNL17A_1708_007"
	end
