From c1e37a6be9fbf437bb09fc31fdb96d0c94b5a631 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 15 May 2018 05:27:10 -0700 Subject: [PATCH] [Arista]: Add a reboot script for all remaining platforms. (#1706) Adds a platform_reboot script for 7050QX-32, 7050QX-32S and 7060CX-32S. This allow a proper cold reboot to happen. --- .../x86_64-arista_7050_qx32/platform_reboot | 87 +++++++++++++++++++ .../x86_64-arista_7050_qx32s/platform_reboot | 87 +++++++++++++++++++ .../x86_64-arista_7060_cx32s/platform_reboot | 18 ++++ 3 files changed, 192 insertions(+) create mode 100755 device/arista/x86_64-arista_7050_qx32/platform_reboot create mode 100755 device/arista/x86_64-arista_7050_qx32s/platform_reboot create mode 100755 device/arista/x86_64-arista_7060_cx32s/platform_reboot diff --git a/device/arista/x86_64-arista_7050_qx32/platform_reboot b/device/arista/x86_64-arista_7050_qx32/platform_reboot new file mode 100755 index 000000000000..da438b8fe52b --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/platform_reboot @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. +# Arista Networks, Inc. Confidential and Proprietary. + +# Reboot script for 7050QX-32 + +from __future__ import print_function +import sys +import mmap, os +import subprocess +from struct import pack, unpack + +class MmapResource( object ): + """Resource implementation for a directly-mapped memory region.""" + + def __init__( self, path ): + try: + fd = os.open( path, os.O_RDWR ) + except EnvironmentError: + print( "FAIL can not open scd memory-map resource file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + try: + size = os.fstat( fd ).st_size + except EnvironmentError: + print( "FAIL can not fstat scd memory-map resource file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + try: + self.mmap_ = mmap.mmap( fd, size, mmap.MAP_SHARED, + mmap.PROT_READ | mmap.PROT_WRITE ) + except EnvironmentError: + print( "FAIL can not map scd memory-map file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + finally: + try: + # Note that closing the file descriptor has no effect on the memory map + os.close( fd ) + except EnvironmentError: + print( "FAIL failed to close scd memory-map file" ) + sys.exit( 1 ) + + def read32( self, addr ): + return unpack( '