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

[pbh]: Add YANG model #7461

Merged
merged 11 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
87 changes: 87 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 @@ -630,6 +630,93 @@
]
}
},
"PBH_HASH_FIELD": {
"inner_ip_proto": {
"hash_field": "INNER_IP_PROTOCOL",
"sequence_id": "1"
},
"inner_l4_dst_port": {
"hash_field": "INNER_L4_DST_PORT",
"sequence_id": "2"
},
"inner_l4_src_port": {
"hash_field": "INNER_L4_SRC_PORT",
"sequence_id": "2"
},
"inner_dst_ipv4": {
"hash_field": "INNER_DST_IPV4",
"ip_mask": "255.0.0.0",
"sequence_id": "3"
},
"inner_src_ipv4": {
"hash_field": "INNER_SRC_IPV4",
"ip_mask": "0.0.0.255",
"sequence_id": "3"
},
"inner_dst_ipv6": {
"hash_field": "INNER_DST_IPV6",
"ip_mask": "ffff::",
"sequence_id": "4"
},
"inner_src_ipv6": {
"hash_field": "INNER_SRC_IPV6",
"ip_mask": "::ffff",
"sequence_id": "4"
}
},
"PBH_HASH": {
"inner_v4_hash": {
"hash_field_list": [
"inner_ip_proto",
"inner_l4_dst_port",
"inner_l4_src_port",
"inner_dst_ipv4",
"inner_src_ipv4"
]
},
"inner_v6_hash": {
"hash_field_list": [
"inner_ip_proto",
"inner_l4_dst_port",
"inner_l4_src_port",
"inner_dst_ipv6",
"inner_src_ipv6"
]
}
},
"PBH_RULE": {
"pbh_table|nvgre": {
"priority": "1",
"ether_type": "0x0800",
"ip_protocol": "0x2f",
"gre_key": "0x2500/0xffffff00",
"inner_ether_type": "0x86dd",
"hash": "inner_v6_hash",
"packet_action": "SET_ECMP_HASH",
"flow_counter": "DISABLED"
},
"pbh_table|vxlan": {
"priority": "2",
"ether_type": "0x0800",
"ip_protocol": "0x11",
"l4_dst_port": "0x12b5",
"inner_ether_type": "0x0800",
"hash": "inner_v4_hash",
"packet_action": "SET_LAG_HASH",
"flow_counter": "ENABLED"
}
},
"PBH_TABLE": {
"pbh_table": {
"interface_list": [
"Ethernet0",
"Ethernet4",
"PortChannel0003",
"PortChannel0004"
],
"description": "NVGRE and VxLAN"
}
},
"INTERFACE": {
"Ethernet112": {},
"Ethernet14": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def initTest(self):
'Mandatory': ['required element', 'Missing'],
'Verify': ['verified'],
'Range': ['does not satisfy', 'range'],
'MinElements': ['Too few'],
'MaxElements': ['Too many'],
'None': []
}

Expand Down
107 changes: 107 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/pbh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"PBH_TABLE_RULE_HASH_HASH_FIELD_VALID": {
"desc": "Configure PBH_TABLE, PBH_RULE, PBH_HASH and PBH_HASH_FIELD."
},
"PBH_TABLE_INVALID_INTERFACE": {
"desc": "Configure non-existing PORT/PORTCHANNEL in PBH_TABLE.",
"eStrKey": "InvalidValue"
},
"PBH_TABLE_EMPTY_INTERFACE_LIST": {
"desc": "Configure empty INTERFACE_LIST in PBH_TABLE.",
"eStrKey": "MinElements"
},
"PBH_TABLE_INVALID_DESCRIPTION": {
"desc": "Configure invalid DESCRIPTION in PBH_TABLE.",
"eStrKey": "Range"
},
"PBH_RULE_INVALID_TABLE": {
"desc": "Configure non-existing PBH_TABLE in PBH_RULE.",
"eStrKey": "LeafRef"
},
"PBH_RULE_INVALID_PRIORITY": {
"desc": "Configure invalid PRIORITY in PBH_RULE.",
"eStrKey": "InvalidValue"
},
"PBH_RULE_INVALID_GRE_KEY": {
"desc": "Configure invalid GRE_KEY in PBH_RULE.",
"eStrKey": "Pattern"
},
"PBH_RULE_INVALID_ETHER_TYPE": {
"desc": "Configure invalid ETHER_TYPE in PBH_RULE.",
"eStrKey": "Pattern"
},
"PBH_RULE_INVALID_IP_PROTOCOL": {
"desc": "Configure invalid IP_PROTOCOL in PBH_RULE.",
"eStrKey": "Pattern"
},
"PBH_RULE_INVALID_IPV6_NEXT_HEADER": {
"desc": "Configure invalid IPV6_NEXT_HEADER in PBH_RULE.",
"eStrKey": "Pattern"
},
"PBH_RULE_INVALID_L4_DST_PORT": {
"desc": "Configure invalid L4_DST_PORT in PBH_RULE.",
"eStrKey": "Pattern"
},
"PBH_RULE_INVALID_INNER_ETHER_TYPE": {
"desc": "Configure invalid INNER_ETHER_TYPE in PBH_RULE.",
"eStrKey": "Pattern"
},
"PBH_RULE_INVALID_HASH": {
"desc": "Configure non-existing PBH_HASH in PBH_RULE.",
"eStrKey": "LeafRef"
},
"PBH_RULE_INVALID_PACKET_ACTION": {
"desc": "Configure invalid PACKET_ACTION in PBH_RULE.",
"eStrKey": "InvalidValue"
},
"PBH_RULE_INVALID_FLOW_COUNTER": {
"desc": "Configure invalid FLOW_COUNTER in PBH_RULE.",
"eStrKey": "InvalidValue"
},
"PBH_RULE_DEFAULT_VALUE_PACKET_ACTION": {
"desc": "Verify default value for PACKET_ACTION field in PBH_RULE.",
"eStrKey": "Verify",
"verify": {
"xpath": "/sonic-pbh:sonic-pbh/PBH_RULE/PBH_RULE_LIST[table_name='pbh_table'][rule_name='nvgre']/packet_action",
"key": "sonic-pbh:packet_action",
"value": "SET_ECMP_HASH"
}
},
"PBH_RULE_DEFAULT_VALUE_FLOW_COUNTER": {
"desc": "Verify default value for FLOW_COUNTER field in PBH_RULE.",
"eStrKey": "Verify",
"verify": {
"xpath": "/sonic-pbh:sonic-pbh/PBH_RULE/PBH_RULE_LIST[table_name='pbh_table'][rule_name='nvgre']/flow_counter",
"key": "sonic-pbh:flow_counter",
"value": "DISABLED"
}
},
"PBH_HASH_INVALID_HASH_FIELD": {
"desc": "Configure invalid HASH_FIELD in PBH_HASH.",
"eStrKey": "LeafRef"
},
"PBH_HASH_EMPTY_HASH_FIELD_LIST": {
"desc": "Configure empty HASH_FIELD_LIST in PBH_HASH.",
"eStrKey": "MinElements"
},
"PBH_HASH_FIELD_INVALID_HASH_FIELD": {
"desc": "Configure invalid HASH_FIELD in PBH_HASH_FIELD.",
"eStrKey": "InvalidValue"
},
"PBH_HASH_FIELD_INVALID_IP_MASK": {
"desc": "Configure invalid IP_MASK in PBH_HASH_FIELD.",
"eStrKey": "InvalidValue"
},
"PBH_HASH_FIELD_IPV4_MASK_HASH_FIELD_MISMATCH": {
"desc": "Configure HASH_FIELD (INNER_DST_IPV6) with IPV4_MASK in PBH_HASH_FIELD.",
"eStrKey": "Must"
},
"PBH_HASH_FIELD_IPV6_MASK_HASH_FIELD_MISMATCH": {
"desc": "Configure HASH_FIELD (INNER_DST_IPV4) with IPV6_MASK in PBH_HASH_FIELD.",
"eStrKey": "Must"
},
"PBH_HASH_FIELD_INVALID_SEQUENCE_ID": {
"desc": "Configure invalid SEQUENCE_ID in PBH_HASH_FIELD.",
"eStrKey": "InvalidValue"
}
}
Loading