forked from sonic-net/sonic-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] Enhance upgrade image script to support chassis devices (sonic…
…-net#12871) Description of PR Summary: Enhance upgrade image script to support chassis device. For chassis device, we need to firstly upgrade the image for supervisor cards, then upgrade the image for line cards. Approach What is the motivation for this PR? Enhance the upgrade_image script to support chassis devices. How did you do it? Upgrade image on the supervisor cards, then wait 900s for the supervisor card to be ready. Upgrade image on the line cards, then wait 300s for the line cards to be ready. The sonichosts defautly run commands on all supervisor cards and line cards at the same time, enhance the framework to be able to upgrade specific hosts. How did you verify/test it? Run upgrade image script on the chassis device and pizzbox device, both of them works well co-authorized by: [email protected]
- Loading branch information
1 parent
78beab7
commit 71edef4
Showing
3 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import enum | ||
|
||
|
||
class ChassisCardType(str, enum.Enum): | ||
# Sample: lab-1111-sup-1 | ||
SUPERVISOR_CARD = "-sup-" | ||
# Sample: lab-1111-lc1-1 | ||
LINE_CARD = "-lc" | ||
|
||
|
||
def is_chassis(sonichosts): | ||
supervisor_card_exists, line_card_exists = False, False | ||
for hostname in sonichosts.hostnames: | ||
if ChassisCardType.SUPERVISOR_CARD.value in hostname: | ||
supervisor_card_exists = True | ||
if ChassisCardType.LINE_CARD.value in hostname: | ||
line_card_exists = True | ||
return supervisor_card_exists and line_card_exists | ||
|
||
|
||
def get_chassis_hostnames(sonichosts, chassis_card_type: ChassisCardType): | ||
res = [] | ||
for hostname in sonichosts.hostnames: | ||
if chassis_card_type.value in hostname: | ||
res.append(hostname) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters