Skip to content

Commit

Permalink
Switchport Modes Port & Port Channel Yang Model Configurations (sonic…
Browse files Browse the repository at this point in the history
…-net#13580)

### Why I did it

-  Modified "sonic-port.yang" for adding support in Port Yang model for the "mode" attribute for adding port modes 

- Modified "sonic-portchannel.yang" for adding support in Port Channel Yang model for the "mode" attribute for adding port modes 

- Updated tests for these modifications

#### How to verify it
 
-  Added support to align SONiC yang with Config_db
  • Loading branch information
ridahanif96 authored Jan 26, 2024
1 parent e8b1722 commit 88f80fb
Show file tree
Hide file tree
Showing 13 changed files with 276 additions and 106 deletions.
135 changes: 90 additions & 45 deletions src/sonic-yang-models/tests/files/sample_config_db.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/port.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
"PORT_VALID_MTU_TEST_2": {
"desc": "PORT_VALID_MTU_TEST_2 no failure."
},
"PORT_INVLAID_MODE_TEST": {
"desc": "PORT_INVLAID_MODE_TEST invalid mode failure.",
"eStrKey" : "Pattern",
"eStr": ["routed|access|trunk"]
},
"PORT_VALID_AUTONEG_TEST_1": {
"desc": "PORT_VALID_AUTONEG_TEST_1 no failure."
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
"eStrKey" : "Pattern",
"eStr": ["0x8100|0x9100|0x9200|0x88a8|0x88A8"]
},
"PORT_CHANNEL_INVALID_MODE": {
"desc": "INCORRECT VALUE OF MODE IN PORT_CHANNEL TABLE.",
"eStrKey" : "Pattern",
"eStr": ["routed|access|trunk"]
},
"PORT_CHANNEL_INVALID_FALLBACK": {
"desc": "INCORRECT PORTCHANNEL FALLBACK IN PORT_CHANNEL TABLE.",
"eStrKey" : "Pattern",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode" : "trunk"
}
]
}
Expand Down Expand Up @@ -244,7 +245,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode" : "trunk"
}
]
}
Expand Down Expand Up @@ -433,7 +435,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode" : "trunk"
}
]
}
Expand Down Expand Up @@ -498,7 +501,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode" : "trunk"
}
]
}
Expand Down Expand Up @@ -579,7 +583,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode" : "trunk"
}
]
}
Expand Down Expand Up @@ -660,7 +665,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode" : "trunk"
}
]
}
Expand Down Expand Up @@ -741,7 +747,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode" : "trunk"
}
]
}
Expand Down Expand Up @@ -822,7 +829,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode" : "trunk"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000
"speed": 25000,
"mode":"trunk"
},
{
"admin_status": "up",
Expand All @@ -36,7 +37,8 @@
"lanes": "71",
"mtu": 9000,
"name": "Ethernet9",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down Expand Up @@ -71,7 +73,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down Expand Up @@ -104,7 +107,8 @@
"description": "Ethernet8",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down Expand Up @@ -140,7 +144,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down Expand Up @@ -176,7 +181,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down Expand Up @@ -204,7 +210,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down Expand Up @@ -232,7 +239,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down Expand Up @@ -260,7 +268,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode": "trunk"
},
{
"admin_status": "up",
Expand All @@ -19,7 +20,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet10",
"speed": 25000
"speed": 25000,
"mode":"routed"
}
]
}
Expand All @@ -32,14 +34,17 @@
"min_links": "1",
"mtu": "9100",
"lacp_key": "auto",
"name": "PortChannel2"
"name": "PortChannel2",
"mode":"trunk"
},
{
"admin_status": "up",
"min_links": "1",
"mtu": "9100",
"lacp_key": "auto",
"name": "PortChannel10"
"name": "PortChannel10",
"mode":"trunk"

}
]
}
Expand Down Expand Up @@ -126,7 +131,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
"speed": 25000,
"mode":"trunk"
},
{
"admin_status": "up",
Expand All @@ -135,7 +141,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet4",
"speed": 25000
"speed": 25000,
"mode":"trunk"
}
]
}
Expand All @@ -148,7 +155,8 @@
"min_links": "1",
"mtu": "9100",
"lacp_key": "auto",
"name": "PortChannel2"
"name": "PortChannel2",
"mode":"trunk"
}
]
}
Expand Down Expand Up @@ -302,7 +310,8 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet12",
"speed": 25000
"speed": 25000,
"mode":"routed"
}
]
}
Expand Down
Loading

0 comments on commit 88f80fb

Please sign in to comment.