============= NSM Operation ============= .. sidebar:: Contents .. contents:: :depth: 3 :local: This chapter covers some aspects related to the :osdx:cfg:`service nsm operation *` tool, which allows operations to be configured to measure network quality with active traffic probes and feed system alarms. To measure network quality, averages of different parameters are calculated, such as: the **Round-Trip-Time (RTT)**, the **jitter** and the **loss** of those packets exchanged between the device and a remote location. These averages are calculated from the last **N** probes sent, which can be configured through the ``window`` field (by default **2**). Depending on the protocol through which to send the probes, the ``type`` of NSM operation must be configured using one of the following values: * ``icmp``: to use ICMP packets. * ``udp``: to use SLA UDP packets. * ``twamp``: to use TWAMP-test packets (rfc5357). In order to easily identify each of the operations created, it is possible to add a short description through the ``description`` field. The probe sending ``interval`` for each NSM operation can also be configured. By default, probes are sent every **second**. For each probe sent, there is a timeout after which the probe is considered lost. This time can be changed through the ``timeout`` field (by default **1 second**). This value is also used as **rtt** for the average rtt/jitter calculation when a packet is lost. Regarding the socket through which the probes are sent, it is possible to configure different parameters: * ``local-address``: to configure the local socket address. * ``local-port``: to configure the local socket port. * ``destination-address``: to configure the destination address (mandatory for all types of operations). * ``destination-port``: to configure the destination port (mandatory for **udp** and **twamp**, not posible for **icmp**). * ``local-vrf`` or ``local-interface``: to configure the **interface** or **vrf** to which the socket has to be bound. So, probes are sent through said **interface** or **vrf**, and packets received from another interface or socket are discarded. * ``mark`` or ``vrf-mark``: to configure the **mark** for each probe sent through the socket. Useful for using mark-based routing or for packet filtering. * ``tos``: to configure the **Type-Of-Service (TOS)** field of the IP packets sent with each probe (by default **0**). Useful for prioritizing packets on the network. * ``ttl``: to configure the **Time-To-Live (TTL)** field of the IP packets sent with each probe (by default **64**). * ``size``: to configure the size of packets sent with each probe. Depending on the type of operation used, a minimum size must be indicated: * ``icmp``: greater than or equal to **12 bytes**. * ``udp``: greater than or equal to **16 bytes**. * ``twamp``: greater than or equal to **41 bytes**. An NSM operation can be configured to feed more than one alarm defined in the system. To do this, the name of the ``alarm`` and the threshold value of the measured network parameter that will ``activate`` this alarm must be indicated. Several thresholds can be set for an alarm: ``rtt``, ``jitter``, ``loss``, ``rtt-jitter`` (the sum of rtt and jitter); so the alarm is activated if any of the configured thresholds is reached. If the value of the measured network parameter does not reach 70% of the activation threshold, an NSM operation also deactivates the alarms being fed. This default deactivation threshold can be changed through the ``deactivate`` field. For both ``activate`` and ``deactivate``, a waiting time can be configured before executing the corresponding action through the ``stabilization-time`` field (by default **0 seconds**). It is also possible to configure a specific window for each alarm through the ``window`` field. By default it uses the general window of the NSM operation described above. Configuration ============= This is the syntax to create a :osdx:cfg:`service nsm operation *`: .. code-block:: none set service nsm operation [ ... ] Examples ======== ICMP operation -------------- Imagine you want to configure an ICMP-type NSM operation to measure network quality every 0.10 seconds and feed two different alarms. For the first alarm, packet loss is checked and the following thresholds are set: * Activation: when the packet loss exceeds 5%. * Deactivation: when the packet loss drops to 0%. For the second alarm, packet rtt delay is checked and the following thresholds are set: * Activation: when the rtt delay exceeds 150 milliseconds. * Deactivation: default value (70% of the activation threshold). In OSDx, this can be achieved by setting the following commands: .. code-block:: none set service nsm operation TEST_OPER alarm TEST_ALARM_1 activate loss 5 set service nsm operation TEST_OPER alarm TEST_ALARM_1 deactivate loss 0 set service nsm operation TEST_OPER alarm TEST_ALARM_2 activate rtt 0.150 set service nsm operation TEST_OPER destination-address 10.0.0.2 set service nsm operation TEST_OPER interval 0.10 set service nsm operation TEST_OPER type icmp :doc:`Here `, you can find more examples related to ``service nsm operation``. Monitoring ========== Operational commands :osdx:op:`service nsm operation show` or :osdx:op:`service nsm operation * show` can be used to display statistics related to NSM operations. *Example:* .. code-block:: none admin@DUT0$ service nsm operation TEST_OPER show ----------------------------------------------------------------------------------------------- Operation Alarm Status RTT(s) Jitter(s) Loss(%) Window Toggled Prev-toggled ----------------------------------------------------------------------------------------------- TEST_OPER TEST_ALARM_2 false 0.000882 0.000323 0.0 2/2 TEST_OPER TEST_ALARM_1 false 0.000882 0.000323 0.0 2/2 Command Summary =============== .. osdx:cmdtree:: cfg service nsm operation .. osdx:cmdtree:: op service nsm operation