Skip to content

Commit 91ff807

Browse files
authored
[pbh]: Add YANG model (#7461)
* [pbh]: Add YANG model. Signed-off-by: Nazarii Hnydyn <[email protected]>
1 parent e362cab commit 91ff807

File tree

5 files changed

+1434
-0
lines changed

5 files changed

+1434
-0
lines changed

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,93 @@
630630
]
631631
}
632632
},
633+
"PBH_HASH_FIELD": {
634+
"inner_ip_proto": {
635+
"hash_field": "INNER_IP_PROTOCOL",
636+
"sequence_id": "1"
637+
},
638+
"inner_l4_dst_port": {
639+
"hash_field": "INNER_L4_DST_PORT",
640+
"sequence_id": "2"
641+
},
642+
"inner_l4_src_port": {
643+
"hash_field": "INNER_L4_SRC_PORT",
644+
"sequence_id": "2"
645+
},
646+
"inner_dst_ipv4": {
647+
"hash_field": "INNER_DST_IPV4",
648+
"ip_mask": "255.0.0.0",
649+
"sequence_id": "3"
650+
},
651+
"inner_src_ipv4": {
652+
"hash_field": "INNER_SRC_IPV4",
653+
"ip_mask": "0.0.0.255",
654+
"sequence_id": "3"
655+
},
656+
"inner_dst_ipv6": {
657+
"hash_field": "INNER_DST_IPV6",
658+
"ip_mask": "ffff::",
659+
"sequence_id": "4"
660+
},
661+
"inner_src_ipv6": {
662+
"hash_field": "INNER_SRC_IPV6",
663+
"ip_mask": "::ffff",
664+
"sequence_id": "4"
665+
}
666+
},
667+
"PBH_HASH": {
668+
"inner_v4_hash": {
669+
"hash_field_list": [
670+
"inner_ip_proto",
671+
"inner_l4_dst_port",
672+
"inner_l4_src_port",
673+
"inner_dst_ipv4",
674+
"inner_src_ipv4"
675+
]
676+
},
677+
"inner_v6_hash": {
678+
"hash_field_list": [
679+
"inner_ip_proto",
680+
"inner_l4_dst_port",
681+
"inner_l4_src_port",
682+
"inner_dst_ipv6",
683+
"inner_src_ipv6"
684+
]
685+
}
686+
},
687+
"PBH_RULE": {
688+
"pbh_table|nvgre": {
689+
"priority": "1",
690+
"ether_type": "0x0800",
691+
"ip_protocol": "0x2f",
692+
"gre_key": "0x2500/0xffffff00",
693+
"inner_ether_type": "0x86dd",
694+
"hash": "inner_v6_hash",
695+
"packet_action": "SET_ECMP_HASH",
696+
"flow_counter": "DISABLED"
697+
},
698+
"pbh_table|vxlan": {
699+
"priority": "2",
700+
"ether_type": "0x0800",
701+
"ip_protocol": "0x11",
702+
"l4_dst_port": "0x12b5",
703+
"inner_ether_type": "0x0800",
704+
"hash": "inner_v4_hash",
705+
"packet_action": "SET_LAG_HASH",
706+
"flow_counter": "ENABLED"
707+
}
708+
},
709+
"PBH_TABLE": {
710+
"pbh_table": {
711+
"interface_list": [
712+
"Ethernet0",
713+
"Ethernet4",
714+
"PortChannel0003",
715+
"PortChannel0004"
716+
],
717+
"description": "NVGRE and VxLAN"
718+
}
719+
},
633720
"INTERFACE": {
634721
"Ethernet112": {},
635722
"Ethernet14": {},

src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def initTest(self):
4646
'Mandatory': ['required element', 'Missing'],
4747
'Verify': ['verified'],
4848
'Range': ['does not satisfy', 'range'],
49+
'MinElements': ['Too few'],
50+
'MaxElements': ['Too many'],
4951
'None': []
5052
}
5153

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"PBH_TABLE_RULE_HASH_HASH_FIELD_VALID": {
3+
"desc": "Configure PBH_TABLE, PBH_RULE, PBH_HASH and PBH_HASH_FIELD."
4+
},
5+
"PBH_TABLE_INVALID_INTERFACE": {
6+
"desc": "Configure non-existing PORT/PORTCHANNEL in PBH_TABLE.",
7+
"eStrKey": "InvalidValue"
8+
},
9+
"PBH_TABLE_EMPTY_INTERFACE_LIST": {
10+
"desc": "Configure empty INTERFACE_LIST in PBH_TABLE.",
11+
"eStrKey": "MinElements"
12+
},
13+
"PBH_TABLE_INVALID_DESCRIPTION": {
14+
"desc": "Configure invalid DESCRIPTION in PBH_TABLE.",
15+
"eStrKey": "Range"
16+
},
17+
"PBH_RULE_INVALID_TABLE": {
18+
"desc": "Configure non-existing PBH_TABLE in PBH_RULE.",
19+
"eStrKey": "LeafRef"
20+
},
21+
"PBH_RULE_INVALID_PRIORITY": {
22+
"desc": "Configure invalid PRIORITY in PBH_RULE.",
23+
"eStrKey": "InvalidValue"
24+
},
25+
"PBH_RULE_INVALID_GRE_KEY": {
26+
"desc": "Configure invalid GRE_KEY in PBH_RULE.",
27+
"eStrKey": "Pattern"
28+
},
29+
"PBH_RULE_INVALID_ETHER_TYPE": {
30+
"desc": "Configure invalid ETHER_TYPE in PBH_RULE.",
31+
"eStrKey": "Pattern"
32+
},
33+
"PBH_RULE_INVALID_IP_PROTOCOL": {
34+
"desc": "Configure invalid IP_PROTOCOL in PBH_RULE.",
35+
"eStrKey": "Pattern"
36+
},
37+
"PBH_RULE_INVALID_IPV6_NEXT_HEADER": {
38+
"desc": "Configure invalid IPV6_NEXT_HEADER in PBH_RULE.",
39+
"eStrKey": "Pattern"
40+
},
41+
"PBH_RULE_INVALID_L4_DST_PORT": {
42+
"desc": "Configure invalid L4_DST_PORT in PBH_RULE.",
43+
"eStrKey": "Pattern"
44+
},
45+
"PBH_RULE_INVALID_INNER_ETHER_TYPE": {
46+
"desc": "Configure invalid INNER_ETHER_TYPE in PBH_RULE.",
47+
"eStrKey": "Pattern"
48+
},
49+
"PBH_RULE_INVALID_HASH": {
50+
"desc": "Configure non-existing PBH_HASH in PBH_RULE.",
51+
"eStrKey": "LeafRef"
52+
},
53+
"PBH_RULE_INVALID_PACKET_ACTION": {
54+
"desc": "Configure invalid PACKET_ACTION in PBH_RULE.",
55+
"eStrKey": "InvalidValue"
56+
},
57+
"PBH_RULE_INVALID_FLOW_COUNTER": {
58+
"desc": "Configure invalid FLOW_COUNTER in PBH_RULE.",
59+
"eStrKey": "InvalidValue"
60+
},
61+
"PBH_RULE_DEFAULT_VALUE_PACKET_ACTION": {
62+
"desc": "Verify default value for PACKET_ACTION field in PBH_RULE.",
63+
"eStrKey": "Verify",
64+
"verify": {
65+
"xpath": "/sonic-pbh:sonic-pbh/PBH_RULE/PBH_RULE_LIST[table_name='pbh_table'][rule_name='nvgre']/packet_action",
66+
"key": "sonic-pbh:packet_action",
67+
"value": "SET_ECMP_HASH"
68+
}
69+
},
70+
"PBH_RULE_DEFAULT_VALUE_FLOW_COUNTER": {
71+
"desc": "Verify default value for FLOW_COUNTER field in PBH_RULE.",
72+
"eStrKey": "Verify",
73+
"verify": {
74+
"xpath": "/sonic-pbh:sonic-pbh/PBH_RULE/PBH_RULE_LIST[table_name='pbh_table'][rule_name='nvgre']/flow_counter",
75+
"key": "sonic-pbh:flow_counter",
76+
"value": "DISABLED"
77+
}
78+
},
79+
"PBH_HASH_INVALID_HASH_FIELD": {
80+
"desc": "Configure invalid HASH_FIELD in PBH_HASH.",
81+
"eStrKey": "LeafRef"
82+
},
83+
"PBH_HASH_EMPTY_HASH_FIELD_LIST": {
84+
"desc": "Configure empty HASH_FIELD_LIST in PBH_HASH.",
85+
"eStrKey": "MinElements"
86+
},
87+
"PBH_HASH_FIELD_INVALID_HASH_FIELD": {
88+
"desc": "Configure invalid HASH_FIELD in PBH_HASH_FIELD.",
89+
"eStrKey": "InvalidValue"
90+
},
91+
"PBH_HASH_FIELD_INVALID_IP_MASK": {
92+
"desc": "Configure invalid IP_MASK in PBH_HASH_FIELD.",
93+
"eStrKey": "InvalidValue"
94+
},
95+
"PBH_HASH_FIELD_IPV4_MASK_HASH_FIELD_MISMATCH": {
96+
"desc": "Configure HASH_FIELD (INNER_DST_IPV6) with IPV4_MASK in PBH_HASH_FIELD.",
97+
"eStrKey": "Must"
98+
},
99+
"PBH_HASH_FIELD_IPV6_MASK_HASH_FIELD_MISMATCH": {
100+
"desc": "Configure HASH_FIELD (INNER_DST_IPV4) with IPV6_MASK in PBH_HASH_FIELD.",
101+
"eStrKey": "Must"
102+
},
103+
"PBH_HASH_FIELD_INVALID_SEQUENCE_ID": {
104+
"desc": "Configure invalid SEQUENCE_ID in PBH_HASH_FIELD.",
105+
"eStrKey": "InvalidValue"
106+
}
107+
}

0 commit comments

Comments
 (0)