.. _example_traffic_selector_rule_vlan_link-out: ######## Link-Out ######## The following scenario shows how to filter packets based on VLAN attributes using traffic selectors. The policy is attached to DUT0's ``link-out`` hook; DUT0 originates the traffic and DUT0's journal is checked. *************************** Test VLAN Selector (802.1Q) *************************** Description =========== A ``traffic policy`` ``MATCH_VLAN`` is configured on DUT0's parent interface (``eth0``) in the link-out hook. The ``traffic selector`` ``VLAN`` filters packets with ``ether-type 8021q`` and ``vlan id 100``, logging matches with prefix ``MATCH_VLAN``. A ping through the 802.1Q VLAN verifies that the selector correctly identifies tagged packets. Scenario ======== .. osdx:tabset:: :suite: link-out :test: testvlanselector(802.1q) :devices: vm:SDE,M10:M10-Smart,M2:M2,RS420:RS420,AresC640:AresC640,SDE11k:SDE11k,Atlas840:Atlas840,M20:M20,H5Rail:H5Rail,M10Plus:M10Plus,H5Auto:H5Auto ************************* Test VLAN Selector (QinQ) ************************* Description =========== A ``traffic policy`` ``MATCH_VLAN`` is configured on DUT0's parent interface (``eth0``) in the link-out hook. The ``traffic selector`` ``VLAN`` filters packets with ``ether-type 8021ad``, ``vlan id 100``, ``vlan protocol 8021q`` and ``vlan inner-id 200``, logging matches with prefix ``MATCH_VLAN``. A ping through the QinQ VLAN verifies that the selector correctly identifies double-tagged packets. Scenario ======== .. osdx:tabset:: :suite: link-out :test: testvlanselector(qinq) :devices: vm:SDE,M10:M10-Smart,M2:M2,RS420:RS420,AresC640:AresC640,SDE11k:SDE11k,Atlas840:Atlas840,M20:M20,H5Rail:H5Rail,M10Plus:M10Plus,H5Auto:H5Auto ****************************************** Test VLAN Selector (QinQ) With PCP Matches ****************************************** Description =========== A ``traffic policy`` ``MATCH_VLAN`` is configured on DUT0's parent interface (``eth0``) in the link-out hook. The ``traffic selector`` ``VLAN`` filters QinQ packets matching ``vlan id 100``, ``vlan pcp 3``, ``vlan inner-id 200`` and ``vlan inner-pcp 5``. Traffic policies ``OUTER_COS`` and ``INNER_COS`` on the outer and inner VLAN sub-interfaces set the required PCP values. Scenario ======== .. osdx:tabset:: :suite: link-out :test: testvlanselector(qinq)withpcpmatches :devices: vm:SDE,M10:M10-Smart,M2:M2,RS420:RS420,AresC640:AresC640,SDE11k:SDE11k,Atlas840:Atlas840,M20:M20,H5Rail:H5Rail,M10Plus:M10Plus,H5Auto:H5Auto ******************************************** Test VLAN Selector (802.1Q) With Not Vlan Id ******************************************** Description =========== The ``traffic selector`` ``VLAN`` uses ``not vlan id 100``. Traffic is sent through VLAN 101, so the negated condition matches (the packet's VLAN id differs from 100), causing rule 1 to match and log with prefix ``MATCH_VLAN``. Scenario ======== .. osdx:tabset:: :suite: link-out :test: testvlanselector(802.1q)withnotvlanid :devices: vm:SDE,M10:M10-Smart,M2:M2,RS420:RS420,AresC640:AresC640,SDE11k:SDE11k,Atlas840:Atlas840,M20:M20,H5Rail:H5Rail,M10Plus:M10Plus,H5Auto:H5Auto ********************************************* Test VLAN Selector (802.1Q) With Not Vlan PCP ********************************************* Description =========== The ``traffic selector`` ``VLAN`` uses ``vlan id 100`` and ``not vlan pcp 3``. A traffic policy ``SET_COS`` configured on the VLAN sub-interface sets the PCP value to 5, so the negated condition matches (the packet's PCP differs from 3), causing rule 1 to match and log with prefix ``MATCH_VLAN``. Scenario ======== .. osdx:tabset:: :suite: link-out :test: testvlanselector(802.1q)withnotvlanpcp :devices: vm:SDE,M10:M10-Smart,M2:M2,RS420:RS420,AresC640:AresC640,SDE11k:SDE11k,Atlas840:Atlas840,M20:M20,H5Rail:H5Rail,M10Plus:M10Plus,H5Auto:H5Auto ************************************************ Test VLAN Selector (QinQ) With Not Vlan Inner-id ************************************************ Description =========== The ``traffic selector`` ``VLAN`` uses ``vlan id 100``, ``vlan protocol 8021q`` and ``not vlan inner-id 200``. Traffic is sent through C-VLAN 201, so the negated condition matches (the packet's inner VLAN id differs from 200), causing rule 1 to match and log with prefix ``MATCH_VLAN``. Scenario ======== .. osdx:tabset:: :suite: link-out :test: testvlanselector(qinq)withnotvlaninner-id :devices: vm:SDE,M10:M10-Smart,M2:M2,RS420:RS420,AresC640:AresC640,SDE11k:SDE11k,Atlas840:Atlas840,M20:M20,H5Rail:H5Rail,M10Plus:M10Plus,H5Auto:H5Auto ************************************************* Test VLAN Selector (QinQ) With Not Vlan Inner-pcp ************************************************* Description =========== The ``traffic selector`` ``VLAN`` uses ``vlan id 100``, ``vlan protocol 8021q``, ``vlan inner-id 200`` and ``not vlan inner-pcp 5``. A traffic policy ``INNER_COS`` configured on the inner VLAN sub-interface sets the inner PCP value to 3, so the negated condition matches (the packet's inner PCP differs from 5), causing rule 1 to match and log with prefix ``MATCH_VLAN``. Scenario ======== .. include:: link-out/testvlanselector(qinq)withnotvlaninner-pcp .. raw:: html