diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index e7b03092ef..89b27eb5f5 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -282,6 +282,11 @@ "SRC_IPV6": "::/0", "PRIORITY": "990000", "DST_IPV6": "::/0" + }, + "EVERFLOW_DSCP|RULE_1": { + "MIRROR_INGRESS_ACTION": "erspan", + "DSCP": "10", + "PRIORITY": "9999" } }, "DEVICE_METADATA": { @@ -750,7 +755,17 @@ "Ethernet25", "Ethernet24" ] + }, + "EVERFLOW_DSCP": { + "type": "MIRROR_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "Ethernet14", + "Ethernet24" + ], + "stage": "ingress" } + }, "PBH_HASH_FIELD": { "inner_ip_proto": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json index 8c307c30f2..980622cbd3 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json @@ -105,5 +105,12 @@ }, "ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": { "desc": "Configure CTRLPLANE with proper action ACCEPT." + }, + "ACL_RULE_WITH_INVALID_MIRROR_INGRESS_ACTION": { + "desc": "Configure ACL_RULE with invalid mirror action.", + "eStrKey" : "LeafRef" + }, + "ACL_RULE_WITH_VALID_MIRROR_INGRESS_ACTION": { + "desc": "Configure ACL_RULE with valid mirror action." } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json index 98acc17a63..b2aa6b3fb1 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json @@ -820,5 +820,75 @@ ] } } + }, + "ACL_RULE_WITH_INVALID_MIRROR_INGRESS_ACTION": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "MIRROR_INGRESS_ACTION": "mirror_session_dscp", + "PRIORITY": 9999, + "RULE_NAME": "Rule_20", + "DSCP": "10" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "" + ], + "stage": "ingress", + "type": "MIRROR_DSCP" + } + ] + } + } + }, + "ACL_RULE_WITH_VALID_MIRROR_INGRESS_ACTION": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "MIRROR_INGRESS_ACTION": "mirror_session_dscp", + "PRIORITY": 9999, + "RULE_NAME": "Rule_20", + "DSCP": "10" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "" + ], + "stage": "ingress", + "type": "MIRROR_DSCP" + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "sonic-mirror-session:MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name":"mirror_session_dscp", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } } } diff --git a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 index f38844d09f..d007f82e09 100644 --- a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 @@ -33,6 +33,10 @@ module sonic-acl { prefix lag; } + import sonic-mirror-session { + prefix sms; + } + description "ACL YANG Module for SONiC OS"; revision 2019-07-01 { @@ -65,6 +69,18 @@ module sonic-acl { type stypes:packet_action; } + leaf MIRROR_INGRESS_ACTION { + type leafref { + path "/sms:sonic-mirror-session/sms:MIRROR_SESSION/sms:MIRROR_SESSION_LIST/sms:name"; + } + } + + leaf MIRROR_EGRESS_ACTION { + type leafref { + path "/sms:sonic-mirror-session/sms:MIRROR_SESSION/sms:MIRROR_SESSION_LIST/sms:name"; + } + } + leaf IP_TYPE { type stypes:ip_type; }