#0) More information on formula syntax: http://doc.itk.ericsson.se/binder/current/html/ItkViewGuide/07_FormulaFiles.html
#1) Any text starting with a '#' is treated as a comment and discarded
#2) Each formula is split into the formula result variable name (part before the '=' sign) and the formula expression (the part after the '=' sign).
#3) Any reference in the formula expression to a counter name of other formula name is replaced by a perl variable reference
#4) The special names sum_<countername>, sum_time_<countername> and sum_mo_<countername> are replaced by a perl reference to variable containing counter aggregates
#5) Each formula expression is then evaluated using perl 'eval'. This means that the syntax of the expressions is the same as that of perl - you can use any perl operators & functions.
#6) The order in which the formulas are defined does not have any importance, a formula can refer to other formulas defined further down in the file
#7) The formula names should not start with "pm"

## Based on M-Mgw R3.1 "User Guide for Performance Measurements" 17/1553-AXM 101 01/3 Uen K       
 

################################
## 4.2   M-MGw Node Functions ##
################################

## 4.2.1 Number of Rejected Emergency Calls
MgwApplication_The_total_number_of_rejected_emergency_calls = pmNrOfRejEmcCalls
## 4.2.2 Software Licensing, Number of Busy Media Stream Channels  
MgwApplication_The_current_number_of_busy_media_stream_channels = pmNrOfMediaStreamChannelsBusy
## 4.2.3 Software Licensing, Number of Rejected connections Due to Capacity Outage
MgwApplication_The_total_number_of_rejected_connections_due_to_capacity_outage = pmNrOfMediaStreamChannelsRejectedDueToCapacity
## 4.2.4 Processor Load  
processor_load = pmProcessorLoad 

#############################################
## 4.3   Virtual Media Gateway Application ##
#############################################

## 4.3.1 AAL2 Terminations  
Vmgw_AAL2_seizure_success_rate = (1 - (pmNrOfAal2TermsRej / pmNrOfAal2TermsReq)) * 100
Vmgw_AAL2_traffic_level = pmNrOfAal2TermsBusy 
## 4.3.2 GCP  
Vmgw_GCP_context_reservation_success_rate = (1 - (pmNrOfContextsRej / pmNrOfContextsReq)) * 100
Vmgw_GCP_link_uptime_in_seconds = pmGcpSystemUpTime
Vmgw_The_total_number_of_received_GCP_messages = pmGcpNrOfReceivedMessages 
Vmgw_The_total_number_of_sent_GCP_messages = pmGcpNrOfSentMessages 
Vmgw_The_current_number_of_busy_GCP_contexts = pmNrOfContextsBusy 
Vmgw_The_total_number_of_GCP_timer_recovery_events = pmGcpNrOfTimerRecovery 
## 4.3.3 IP Terminations
Vmgw_The_IP_termination_seizure_success_rate_per_VMGw = (1 - (pmNrOfIpTermsRej/pmNrOfIpTermsReq)) * 100
Vmgw_The_current_number_of_busy_IP_terminations_per_VMGw = pmNrOfIpTermsBusy 
## 4.3.4 TDM Terminations  
Vmgw_TDM_group_utilization_rate = (pmNrOfTdmTermsBusy / 31) * 100
Vmgw_TDM_termination_reservation_success_rate = (1 - (pmNrOfTdmTermsRej / pmNrOfTdmTermsReq)) * 100

#################################
## 4.4   Media Stream Platform ##
#################################

## 4.4.1 Circuit Switched Data, Analogue Services  
##  CsdDigitalPool - peg
CsdDigitalPool_Originating_GSM_modem_connection_success_rate = (pmModemOSuccGsm / (pmModemOSuccGsm + pmModemOFailGsm)) * 100 
CsdDigitalPool_Terminating_GSM_modem_connection_success_rate = (pmModemTSuccGsm / (pmModemTSuccGsm + pmModemTFailGsm)) * 100 
CsdDigitalPool_Originating_WCDMA_modem_connection_success_rate = (pmModemOSucc / (pmModemOSucc + pmModemOFail)) * 100
CsdDigitalPool_Terminating_WCDMA_modem_connection_success_rate = (pmModemTSucc / (pmModemTSucc + pmModemTFail)) * 100
##  CsdDigitalPool - level
CsdDigitalPool_The_current_number_of_originating_non_transparent_GSM_modem_connections = pmNumModemOGsm
CsdDigitalPool_The_current_number_of_terminating_non_transparent_GSM_modem_connections = pmNumModemTGsm
CsdDigitalPool_The_current_number_of_originating_non_transparent_WCDMA_modem_connections = pmNumModemO
CsdDigitalPool_The_current_number_of_terminating_non_transparent_WCDMA_modem_connections = pmNumModemT
##  CsdModemPool - peg 
CsdModemPool_The_total_number_of_asynchronous_non_transparent_GSM_modem_connections = pmAsyncNonTransModemGsm 
CsdModemPool_The_total_number_of_asynchronous_transparent_GSM_modem_connections = pmAsyncTransModemGsm 
CsdModemPool_The_total_number_of_synchronous_transparent_GSM_modem_connections = pmSyncTransModemGsm 
CsdModemPool_The_total_number_of_GSM_modem_connections = pmAsyncNonTransModemGsm + pmAsyncTransModemGsm + pmSyncTransModemGsm 
CsdModemPool_The_total_number_of_GSM_V90_modem_connections = pmV90Gsm 
CsdModemPool_The_total_number_of_GSM_V34_modem_connections = pmV34Gsm 
CsdModemPool_The_total_number_of_GSM_V32bis_modem_connections = pmV32bisGsm 
CsdModemPool_The_total_number_of_GSM_V32_modem_connections = pmV32Gsm 
CsdModemPool_The_total_number_of_GSM_V22bis_modem_connections = pmV22bisGsm 
CsdModemPool_The_total_number_of_GSM_V22_modem_connections = pmV22Gsm 
CsdModemPool_The_total_number_of_GSM_V21_modem_connections = pmV21Gsm 
CsdModemPool_The_total_number_of_MANT_WCDMA_modem_connections = pmAsyncNonTransModemWcdma 
CsdModemPool_The_total_number_of_WCDMA_V90_modem_connections = pmV90 
CsdModemPool_The_total_number_of_WCDMA_V34_modem_connections = pmV34 
CsdModemPool_The_total_number_of_WCDMA_V32bis_modem_connections = pmV32bis 
CsdModemPool_The_total_number_of_WCDMA_V32_modem_connections = pmV32 
CsdModemPool_The_total_number_of_WCDMA_V22bis_modem_connections = pmV22bis 
CsdModemPool_The_total_number_of_WCDMA_V22_modem_connections = pmV22 
CsdModemPool_The_total_number_of_WCDMA_V21_modem_connections = pmV21 

## 4.4.2 Circuit Switched Data, Digital Services
##  CsdDigitalPool - peg
CsdDigitalPool_GSM_FTM_connection_reservation_success_rate = (pmFtmSuccGsm / (pmFtmSuccGsm + pmFtmFailGsm)) * 100
CsdDigitalPool_GSM_UDI_connection_reservation_success_rate = (pmUdiSuccGsm / (pmUdiSuccGsm + pmUdiFailGsm)) * 100
CsdDigitalPool_WCDMA_FTM_connection_reservation_success_rate = (pmFtmSucc / (pmFtmSucc + pmFtmFail)) * 100
CsdDigitalPool_WCDMA_UDI_connection_reservation_success_rate = (pmUdiSucc / (pmUdiSucc + pmUdiFail)) * 100
## CsdDigitalPool - level
CsdDigitalPool_The_current_number_of_non_transparent_GSM_FTM_connections = pmNumFtmGsm 
CsdDigitalPool_The_current_number_of_GSM_UDI_connections = pmNumUdiGsm 
CsdDigitalPool_The_current_number_of_non_transparent_WCDMA_CSD_FTM_connections = pmNumFtm
CsdDigitalPool_The_current_number_of_WCDMA_UDI_connections = pmNumUdi 
## UpMfhPool - peg
UpMfhPool_The_current_number_of_transparent_WCDMA_CSD_connections = pmNumBitTrans 

## 4.4.3 Interactive Messaging, Basic Message Success Rate  
IM_basic_message_success_rate = (pmCallAttempts / (pmCallAttempts + pmFailedCallAttempts)) * 100
## 4.4.4 Interactive Messaging, Message Composition Success Rate  
IM_comosite_message_success_rate = (pmCallAttempts / (pmCallAttempts + pmFailedCallAttempts)) * 100
## 4.4.5 Interactive Messaging, Variable Message Success Rate  
IM_variable_message_success_rate = (pmCallAttempts / (pmCallAttempts + pmFailedCallAttempts)) * 100
## 4.4.6 Media Stream Resource Reservation Success Rate  
Device_pool_reservation_success_rate = (1 - (pmUnsuccSeizures / pmTotalSeizures)) * 100
   ## 4.4.7 Media Stream Resource Utilization Rate  
   ##   Device_pool_utilization_rate = (pmBusyDevices / totalNrOfDevices) * 100
   ## 4.4.8 Network Probe  

###############################
## 4.5   Signalling Services ##
###############################

## 4.5.1 MTP2 Quality Of Service 
Mtp2Tp_The_total_number_of_received_negative_acknoledgements = pmNoOfNacks 
Mtp2Tp_The_total_number_of_signal_units_received_in_error = pmNoOfSuReceivedInError 
## 4.5.2 MTP2 Signalling Link Usage 
Mtp2Tp_Received_MSUs_per_second = pmNoOfMSUReceived / 900
Mtp2Tp_Sent_MSUs_per_second = pmNoOfMSUTransmitted / 900

## 4.5.3 MTP3b Signalling Link Usage  
Mtp3bSl_Received_MSUs_per_second = pmNoOfMSURec / 900 
Mtp3bSl_Sent_MSUs_per_second = pmNoOfMSUSent / 900 

   ##   ## 4.5.4 SCCP Policing  
   ##   The total number of rejected SCCP messages = SccpPolicing::pmNrOfRejectMsg 
   ##   ## 4.5.5 SCCP Relay
   ##   The total number of (connectionless) SCCP messages received per second = (SccpSp::pmNrOfLUDTRec + SccpSp::pmNrOfUDTRec + SccpSp::pmNrOfUDTSRec + SccpSp::pmNrOfXUDTRec + SccpSp::pmNrOfXUDTSRec) / 900
   ##   The total number of (connectionless) SCCP messages sent per second = (SccpSp::pmNrOfLUDTSSent + SccpSp::pmNrOfUDTSent + SccpSp::pmNrOfUDTSSent + SccpSp::pmNrOfXUDTSent + SccpSp::pmNrOfXUDTSSent) / 900
   ##   ## 4.5.6 SCCP Quality of Service 
   ##   The total number of SCCP Protocol Data Unit Error (ERR) messages received per second = SccpSp::pmNrOfERRRec / 900
   ##   The total number of SCCP ERR messages sent per second = SccpSp::pmNrOfERRSent / 900
   ##   
   ##   ## 4.5.7 SIGTRAN 
   ##   The total number of received IP datagrams = IpAccessHostGsb::pmIpInReceives 
   ##   The total number of sent IP datagrams = IpAccessHostGsb::pmIpOutRequests - IpAccessHostGpb::pmIpOutDiscards
   ##   The number of payload data messages sent per second = M3uaAssociation::pmNrOfDataMsgSent / MEAS_LENGTH
   ##   The number of payload data messages received per second = M3uaAssociation::pmNrOfDataMsgRec / MEAS_LENGTH
   ##   The total number of received SCTP data chunks = Sctp::pmSctpStatRecChunks 
   ##   The total number of sent SCTP data chunks = Sctp::pmSctpStatSentChunks + Sctp::pmSctpStatRetransChunks
   ##   The total number of sent SCTP packages = Sctp::pmSctpStatSentPackages 
   ##   The total number of received SCTP packages = Sctp::pmSctpStatReceivedPackages 
   ##   The ratio of discarded received IP datagrams (in %) = (IpAccessHostGpb::pmIpInDiscards / IpAccessHostGpb::pmIpInReceives) * 100
   ##   The ratio of discarded sent IP datagrams (in %) = (IpAccessHostGpb::pmIpOutDiscards / IpAccessHostGpb::pmIpOutRequests) * 100
   ##   The total number of dropped sent SCTP chunks = Sctp::pmSctpStatSentChunksDropped 
   ##   The total number of dropped received SCTP chunks = Sctp::pmSctpStatRecChunksDropped 
   ##   The total number of retransmitted SCTP chunks = Sctp::pmSctpStatRecChunksDropped 
   ##   The total number of discarded data messages (ITU) = Mtp3bSpItu::pmNrOfM3uaDataMsgDiscarded 
   ##   The total number of discarded data messages (ANSI) = Mtp3bSpAnsi::pmNrOfM3uaDataMsgDiscarded 
   ##   The total number of error messages received = M3uaAssociation::pmNrOfErrorMsgRec 
   ##   The total number of error messages sent = M3uaAssociation::pmNrOfErrorMsgSent 



###############################
## 4.6   Transport Services  ##
###############################

## 4.6.1 AAL2 Traffic 
Aal2Ap_userlabel = pmuserLabel
Aal2Ap_AAL2_pipe_utilization_rate = ((pmExisOrigConns + pmExisTermConns + pmExisTransConns) / ((pmnrOfConfiguredAal2Paths - pmnrOfUnavailableAal2Paths) * 248)) * 100
Aal2Ap_Incoming_AAL2_connection_reservation_success_rate = (pmSuccInConnsRemote / (pmSuccInConnsRemote + pmUnSuccInConnsRemote)) * 100
Aal2Ap_Outgoing_AAL2_connection_reservation_success_rate = (pmSuccOutConnsRemote / (pmSuccOutConnsRemote + pmUnSuccOutConnsRemote)) * 100 
   
   ##   ## 4.6.2 ATM Quality of Service  
   ##   Received cell loss rate = VpcTp::pmBwLostCells / VplTp::pmReceivedAtmCells 
   ##   Transmitted cell loss rate = VpcTp::pmFwLostCells / VplTp::pmTransmittedAtmCells 
   ##   Received cell error rate = VpcTp::pmBwErrBlocks / VplTp::pmReceivedAtmCells 
   ##   Transmitted cell error rate = VpcTp::pmFwErrBlocks / VplTp::pmTransmittedAtmCells 
   ##   Received cell misinsertion rate = VpcTp::pmBwMissinsCells / VplTp::pmReceivedAtmCells 
   ##   Transmitted cell misinsertion rate = VpcTp::pmFwMissinsCells / VplTp::pmTransmittedAtmCells 
   ##   Received ATM O&M cell loss rate = VpcTp::pmLostBrCells / VplTp::pmReceivedAtmCells 
   ##   Transmitted ATM O&M cell loss rate = VpcTp::pmLostFpmCells / VplTp::pmTransmittedAtmCells

## 4.6.3 ATM Traffic 

## AtmPort
AtmPort_Received_ATM_cells_per_second = pmReceivedAtmCells / 900 
AtmPort_Transmitted_ATM_cells_per_second = pmTransmittedAtmCells / 900
AtmPort_Received_bandwidth_Mbps = (((pmReceivedAtmCells / 900) * 53 * 8) / 1048576)
AtmPort_Transmitted_bandwidth_Mbps = (((pmTransmittedAtmCells / 900) * 53 * 8) / 1048576)
AtmPort_STM1_Usage_rate_of_received_cells_in_percent = ((pmReceivedAtmCells / 900) / 353207) * 100
AtmPort_STM1_Usage_rate_of_transmitted_cells_in_percent = ((pmTransmittedAtmCells / 900) / 353207) * 100

## VplTp
VplTp_Received_ATM_cells_per_second = pmReceivedAtmCells / 900 
VplTp_Transmitted_ATM_cells_per_second = pmTransmittedAtmCells / 900
VplTp_Received_bandwidth = (((pmReceivedAtmCells / 900) * 53 * 8) / 1048576)
VplTp_Transmitted_bandwidth = (((pmTransmittedAtmCells / 900) * 53 * 8) / 1048576)
##   Usage rate of received cells = ((pmReceivedAtmCells / 900) / AtmTrafficDescriptor::egressAtmPcr) * 100
##   Usage rate of transmitted cells = ((pmTransmittedAtmCells / 900) / AtmTrafficDescriptor::ingressAtmPcr) * 100

## VclTp
VclTp_Received_ATM_cells_per_second = pmReceivedAtmCells/900
VclTp_Transmitted_ATM_cells_per_second = pmTransmittedAtmCells/900
VclTp_Received_bandwidth =(((pmReceivedAtmCells/900)*53*8)/1048576)
VclTp_Transmitted_bandwidth =(((pmTransmittedAtmCells/900)*53*8)/1048576)
   ##   VclTp_Usage_rate_of_received_cells =((pmReceivedAtmCells/900)/pmAtmTrafficDescriptor_egressAtmPcr)*100
   ##   VclTp_Usage_rate_of_transmitted_cells =((pmTransmittedAtmCells/900)/pmAtmTrafficDescriptor_ingressAtmPcr)*100

## ImaGroup
ImaGroup_The_total_number_of_one_second_intervals_where_the_Group_Traffic_State_Machine_is_down = pmGrUasIma
ImaGroup_The_total_number_of_local_end_group_failure_condition_entrances = pmGrFc
ImaGroup_The_total_number_of_far_end_group_failure_condition_entrances = pmGrFcFe
## ImaLink
ImaLink_The_total_number_of_IMA_Control_Protocol_violations = pmIvIma 
ImaLink_The_total_number_of_Out_of_IMA_Frame_anomalies = pmOifIma 
ImaLink_The_total_number_of_Rx_link_failure_alarm_condition_entrances = pmRxFc
ImaLink_The_total_number_of_Rx_link_failure_alarm_condition_entrances_from_far_end = pmRxFcFe
ImaLink_The_total_number_of_stuff_events_inserted_in_the_receive_direction = pmRxStuffIma
ImaLink_The_total_number_of_Rx_Unusable_Seconds = pmRxUusIma
ImaLink_The_total_number_of_Rx_Unusable_Seconds_indications_from_the_far_end = pmRxUusImaFe
ImaLink_The_total_number_of_Severely_Errored_Seconds = pmSesIma 
ImaLink_The_total_number_of_Severely_Errored_Seconds_at_far_end = pmSesImaFe 
ImaLink_The_total_number_of_Tx_link_failure_alarm_condition_entrances = pmTxFc
ImaLink_The_total_number_of_Tx_link_failure_alarm_condition_entrances_from_far_end = pmTxFcFe
ImaLink_The_total_number_of_stuff_events_inserted_in_the_transmit_direction = pmTxStuffIma
ImaLink_The_total_number_of_Tx_Unusable_Seconds = pmTxUusIma
ImaLink_The_total_number_of_Tx_Unusable_Seconds_indications_from_the_Far_End = pmTxUusImaFe
ImaLink_The_total_number_of_Unavailable_Seconds = pmUasIma
ImaLink_The_total_number_of_Unavailable_Seconds_at_far_end = pmUasImaFe 



   ##   ## 4.6.4 IP Payload 
   ##   The ratio of errored, received IP packets (in %) = ((IpAccessHostMsb::pmIpInAddrErrors + IpAccessHostMsb::pmIpInHdrErrors + IpAccessHostMsb::pmIpInUnknownErrors)) / IpAccessHostMsb::pmIpInReceives) * 100
   ##   The total number of ICMP Destination Unreachable messages received = IpAccessHostMsb::pmIcmpInDestUnreachs
   ##   The total number of ICMP messages received having ICMP specific errors = IpAccessHostMsb::pmIcmpInErrors
   ##   The total number of ICMP messages received = IpAccessHostMsb::pmIcmpInMsgs 
   ##   The total number of ICMP Destination Unreachable messages sent = IpAccessHostMsb::pmIcmpOutDestUnreachs
   ##   The total number of ICMP messages sent = IpAccessHostMsb::pmIcmpOutMsgs 
   ##   The total number of received IP datagrams discarded due to invalid IP-address = IpAccessHostMsb::pmIpInAddrErrors
   ##   The total number of received IP datagrams discarded due to errors in the IP header = IpAccessHostMsb::pmIpInHdrErrors
   ##   The total number of received IP datagrams discarded due to unknown protocol = IpAccessHostMsb::pmIpInUnknownProtos
   ##   The total number of IP datagrams requested to be sent = IpAccessHostMsb::pmIpOutrequests 
   ##   The total number of UDP datagrams delivered to UDP users = IpAccessHostMsb::pmUdpInDatagrams 
   ##   The total number of received UDP datagrams not delivered due to errors = IpAccessHostMsb::pmUdpInErrors
   ##   The total number of received UDP datagrams with no application at the destination port = IpAccessHostMsb::pmUdpNoPorts
   ##   The total number of sent UDP datagrams = IpAccessHostMsb::pmUdpOutDatagrams 
   ##   The total number of received IP datagrams = IpAccessHostMsb::pmIpInReceives 
   ##   The total number of sent IP datagrams = IpAccessHostMsb::pmIpOutRequests 



##########################################################################

### ADDITIONAL FORMULAS

##########################################################################

## Aal2Ap
NoAal2SetupAttempts =  pmSuccInConnsRemote + pmSuccOutConnsRemote + pmUnSuccInConnsLocal + pmUnSuccInConnsRemote + pmUnSuccOutConnsLocal + pmUnSuccOutConnsRemote
Aal2SetupFail  = 100 * (pmUnSuccInConnsRemote + pmUnSuccOutConnsRemote) / NoAal2SetupAttempts
Aal2Congestion  = 100 * (pmUnSuccInConnsLocal + pmUnSuccOutConnsLocal) / NoAal2SetupAttempts
AAL2_traffic_level = (pmExisOrigConns + pmExisTermConns + pmExisTransConns)
Aal2Ap_ExisOrigConns = pmExisOrigConns
Aal2Ap_ExisTermConns = pmExisTermConns
Aal2Ap_ExisTransConns = pmExisTransConns

## Aal2Sp
Aal2Sp_UnsuccessfulConnsInternal = pmUnsuccessfulConnsInternal

## Mtp3bSpItu
Mtp3bSpItu_number_of_user_part_messages_discarded_due_to_routing_error = pmNoOfUPMsgDiscardedDueToRoutingErr
Mtp3bSpItu_number_of_times_the_adjacent_nodes_has_restarted = pmNoOfTimerT21WasStarted

## Mtp3bAp
Mtp3bAp_number_of_received_user_part_unavailable_messages = pmNoOfUserPartUnavailRec
Mtp3bAp_number_of_Adjacent_SPs_that_are_not_accessible_via_direct_links = pmNoOfAdjacentSPNotAccessible

## Mtp3bSr
Mtp3bSr_number_of_accumulated_seconds_route_unavailable = pmNoOfSecondsAccumulatedRouteUnavailable

## NniSaalTp
NniSaalTp_number_of_successfully_sent_SDUs = pmNoOfSentSDUs
NniSaalTp_number_of_successfully_received_SDUs = pmNoOfReceivedSDUs
NniSaalTp_number_of_all_signalling_link_failures = pmNoOfAllSLFailures
NniSaalTp_number_of_local_congestions = pmNoOfLocalCongestions
NniSaalTp_number_of_remote_congestions = pmNoOfRemoteCongestions
NniSaalTp_accumulated_time_in_service = pmLinkInServiceTime


Device_pool_current_number_of_busy_devices = pmBusyDevices

Os155SpiTtp_errored_seconds_for_multiplexer_section = pmMsEs
Os155SpiTtp_severely_errored_seconds_for_multiplexer_section = pmMsSes

Vc4Ttp_errored_seconds = pmVcEs
Vc4Ttp_severely_errored_seconds = pmVcSes

Vc12Ttp_errored_seconds = pmVcEs
Vc12Ttp_severely_errored_seconds = pmVcSes

E1Ttp_errored_seconds = pmEs
E1Ttp_severely_errored_seconds = pmSes

E1PhysPathTerm_errored_seconds = pmEs
E1PhysPathTerm_severely_errored_seconds = pmSes
