Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[yang]YANG model for policer table #23

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,7 @@
"queue": "0",
"src_ip": "10.1.1.1",
"ttl": "10",
"policer": "everflow_static_policer",
"type": "ERSPAN"
},
"span": {
Expand All @@ -1564,5 +1565,15 @@
"UNKNOWN_TABLE": {
"Error": "This Table is for testing, This Table does not have YANG models."
}
},
"POLICER": {
"everflow_static_policer": {
"meter_type": "bytes",
"mode": "sr_tcm",
"cir": "12500000",
"cbs": "12500000",
"color": "aware",
"red_packet_action": "drop"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,86 @@
"desc": "Configuring ERSPAN entry with valid values."
},
"MIRROR_ERSPAN_ENTRY_WRONG_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid type",
"desc": "Configuring ERSPAN entry with invalid type",
"eStrKey": "InvalidValue"
},
"MIRROR_ERSPAN_ENTRY_WRONG_DST_IP": {
"desc": "Configurinng ERSPAN entry with invalid dst_ip",
"desc": "Configuring ERSPAN entry with invalid dst_ip",
"eStrKey" : "Pattern"
},
"MIRROR_ERSPAN_ENTRY_WRONG_DST_IP_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid dst_ip",
"desc": "Configuring ERSPAN entry with invalid dst_ip",
"eStrKey" : "When"
},
"MIRROR_ERSPAN_ENTRY_WRONG_SRC_IP": {
"desc": "Configurinng ERSPAN entry with invalid src_ip",
"desc": "Configuring ERSPAN entry with invalid src_ip",
"eStrKey" : "Pattern"
},
"MIRROR_ERSPAN_ENTRY_WRONG_SRC_IP_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid src_ip",
"desc": "Configuring ERSPAN entry with invalid src_ip",
"eStrKey" : "When"
},
"MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid GRE type",
"desc": "Configuring ERSPAN entry with invalid GRE type",
"eStrKey" : "Pattern"
},
"MIRROR_ERSPAN_ENTRY_GRE_WRONG_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid GRE type",
"desc": "Configuring ERSPAN entry with invalid GRE type",
"eStrKey" : "When"
},
"MIRROR_ERSPAN_ENTRY_WRONG_DSCP": {
"desc": "Configurinng ERSPAN entry with invalid dscp",
"desc": "Configuring ERSPAN entry with invalid dscp",
"eStr" : "Invalid dscp value"
},
"MIRROR_ERSPAN_ENTRY_WRONG_DSCP_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid dscp",
"desc": "Configuring ERSPAN entry with invalid dscp",
"eStrKey" : "When"
},
"MIRROR_ERSPAN_ENTRY_WRONG_TTL": {
"desc": "Configurinng ERSPAN entry with invalid ttl",
"desc": "Configuring ERSPAN entry with invalid ttl",
"eStr": "Invalid TTL value"
},
"MIRROR_ERSPAN_ENTRY_WRONG_TTL_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid ttl",
"desc": "Configuring ERSPAN entry with invalid ttl",
"eStrKey" : "When"
},
"MIRROR_ERSPAN_ENTRY_VALID_SRC_PORT": {
"desc": "Configurinng ERSPAN entry with valid source port"
"desc": "Configuring ERSPAN entry with valid source port"
},
"MIRROR_ERSPAN_ENTRY_VALID_SRC_PORTCHANNEL": {
"desc": "Configurinng ERSPAN entry with valid source portchannel"
"desc": "Configuring ERSPAN entry with valid source portchannel"
},
"MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": {
"desc": "Configurinng ERSPAN entry with invalid source port",
"desc": "Configuring ERSPAN entry with invalid source port",
"eStrKey" : "InvalidValue"
},
"MIRROR_SPAN_ENTRY_WITH_VALID_VALUES": {
"desc": "Configurinng SPAN entry with valid source and destination ports"
"desc": "Configuring SPAN entry with valid source and destination ports"
},
"MIRROR_SPAN_ENTRY_INVALID_DST_PORT": {
"desc": "Configurinng SPAN entry with invalid destination ports",
"desc": "Configuring SPAN entry with invalid destination ports",
"eStrKey" : "InvalidValue"
},
"MIRROR_SPAN_ENTRY_INVALID_DST_PORT_TYPE": {
"desc": "Configurinng SPAN entry with invalid destination ports",
"desc": "Configuring SPAN entry with invalid destination ports",
"eStrKey" : "When"
},
"MIRROR_SPAN_ENTRY_VALID_DST_PORT_CPU": {
"desc": "Configurinng SPAN entry with valid destination port CPU"
"desc": "Configuring SPAN entry with valid destination port CPU"
},
"MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": {
"desc": "Configurinng SPAN entry with invalid destination ports",
"desc": "Configuring SPAN entry with invalid destination ports",
"eStrKey" : "InvalidValue"
},
"MIRROR_SPAN_ENTRY_INVALID_DIRECTION": {
"desc": "Configurinng SPAN entry with invalid direction",
"desc": "Configuring SPAN entry with invalid direction",
"eStrKey": "InvalidValue"
},
"MIRROR_ERSPAN_ENTRY_WITH_VALID_POLICER": {
"desc": "Configuring SPAN entry with valid policer"
},
"MIRROR_ERSPAN_ENTRY_WITH_INVALID_POLICER": {
"desc": "Configuring SPAN entry with invalid policer",
"eStrKey": "LeafRef"
}
}
61 changes: 61 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/policer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"POLICER_TABLE": {
"desc": "Configure policer with all fields."
},
"POLICER_MANDATORY_MODE": {
"desc": "Configure policer with no mode.",
"eStrKey" : "Mandatory"
},
"POLICER_MANDATORY_METER_TYPE": {
"desc": "Configure policer with no meter type.",
"eStrKey" : "Mandatory"
},
"POLICER_UNKNOWN_METER_TYPE": {
"desc": "Configure policer with unknown meter type.",
"eStrKey" : "InvalidValue",
"eStr" : ["meter_type"]
},
"POLICER_UNKNOWN_MODE": {
"desc": "Configure policer with unknown mode.",
"eStrKey" : "InvalidValue",
"eStr" : ["mode"]
},
"POLICER_UNKNOWN_ACTION": {
"desc": "Configure policer with unknown action.",
"eStrKey" : "InvalidValue",
"eStr" : ["red_action"]
},
"POLICER_UNKNOWN_COLOR": {
"desc": "Configure policer with unknown color awareness.",
"eStrKey" : "InvalidValue",
"eStr" : ["color"]
},
"POLICER_CBS_WITHOUT_CIR": {
"desc": "Configure policer with cbs but without cir.",
"eStr": ["cbs can't be configured without cir."]
},
"POLICER_CBS_LESS_THAN_CIR": {
"desc": "Configure policer with cbs less than cir.",
"eStr": ["cbs must be greater than or equal to cir"]
},
"POLICER_PIR_LESS_THAN_CIR": {
"desc": "Configure policer with pir less than cir.",
"eStr": ["pir must be greater than or equal to cir"]
},
"POLICER_PBS_WITH_STORM": {
"desc": "Configure policer with pbs configured in storm mode.",
"eStrKey" : "When"
},
"POLICER_PBS_LESS_THAN_CBS": {
"desc": "Configure policer with pbs less than cbs.",
"eStr": ["pbs must be greater than or equal to cbs"]
},
"POLICER_PIR_WITHOUT_CIR": {
"desc": "Configure policer with pir but without cir.",
"eStr": ["pir can't be configured without cir."]
},
"POLICER_WHEN_SRTCM_WITH_PIR": {
"desc": "Configure policer with pir configured in sr_tcm mode.",
"eStrKey" : "When"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -442,5 +442,56 @@
]
}
}
},
"MIRROR_ERSPAN_ENTRY_WITH_VALID_POLICER": {
"sonic-policer:sonic-policer": {
"sonic-policer:POLICER": {
"POLICER_LIST": [
{
"name": "erspan_policer",
"meter_type":"packets",
"mode":"tr_tcm",
"color": "aware",
"cir":"5000",
"cbs":"5000",
"pir":"15000",
"pbs":"15000",
"red_action":"drop"
}
]
}
},
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10",
"policer": "erspan_policer"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_WITH_INVALID_POLICER": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10",
"policer": "erspan_policer2"
}
]
}
}
}
}
Loading