Skip to content

Commit

Permalink
Merge pull request #37 from aristanetworks/dev
Browse files Browse the repository at this point in the history
Sync dev to main
  • Loading branch information
mayank-singla001 authored Nov 5, 2024
2 parents ad90f8d + f5a9044 commit c871943
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
17 changes: 11 additions & 6 deletions BootstrapScriptWithToken/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
# By default, windows uses (CR LF), you need to convert the newline char to linux (LF).

# Addresses for CVaaS
# Note: The correct regional URL where the CVaaS tenant is deployed must be used for EOS versions
# older than 4.30. The following are the cluster URLs used in production:
# Note: If the EOS version is newer than 4.30, the URL "www.arista.io" can be used. Otherwise if
# the EOS version is older than 4.30, the correct regional URL where the CVaaS tenant is deployed
# must be used. The following are the cluster URLs used in production:
# United States 1a: "www.arista.io"
# United States 1b: "www.cv-prod-us-central1-b.arista.io"
# United States 1c: "www.cv-prod-us-central1-c.arista.io"
Expand Down Expand Up @@ -346,6 +347,7 @@ def checkWithRedirector( self, serialNum ):
self.bootstrapURL = self.getBootstrapURL( assignment )
except Exception as e:
log("No assignment found. Error talking to redirector - %s" % e )
raise e

def getBootstrapScript( self ):
# setting Sysdb access variables
Expand All @@ -355,7 +357,6 @@ def getBootstrapScript( self ):
# sysdb paths accessed
cellID = str( Cell.cellId() )
mibStatus = pathHelper.getEntity( "hardware/entmib" )
tpmStatus = pathHelper.getEntity( "cell/" + cellID + "/hardware/tpm/status" )

# setting header information
headers = {}
Expand All @@ -364,9 +365,13 @@ def getBootstrapScript( self ):
headers[ 'X-Arista-HardwareVersion' ] = mibStatus.root.hardwareRev
headers[ 'X-Arista-Serial' ] = mibStatus.root.serialNum

headers[ 'X-Arista-TpmApi' ] = tpmStatus.tpmVersion
headers[ 'X-Arista-TpmFwVersion' ] = tpmStatus.firmwareVersion
headers[ 'X-Arista-SecureZtp' ] = str( tpmStatus.boardValidated )
try:
tpmStatus = pathHelper.getEntity( "cell/" + cellID + "/hardware/tpm/status" )
headers[ 'X-Arista-TpmApi' ] = tpmStatus.tpmVersion
headers[ 'X-Arista-TpmFwVersion' ] = tpmStatus.firmwareVersion
headers[ 'X-Arista-SecureZtp' ] = str( tpmStatus.boardValidated )
except Exception as e:
log("Exception while getting device tpmStatus: %s" % e)

headers[ 'X-Arista-SoftwareVersion' ] = getValueFromFile(
"/etc/swi-version", "SWI_VERSION" )
Expand Down
17 changes: 11 additions & 6 deletions BootstrapScriptWithToken/bootstrap_template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import time
# By default, windows uses (CR LF), you need to convert the newline char to linux (LF).

# Addresses for CVaaS
# Note: The correct regional URL where the CVaaS tenant is deployed must be used for EOS versions
# older than 4.30. The following are the cluster URLs used in production:
# Note: If the EOS version is newer than 4.30, the URL "www.arista.io" can be used. Otherwise if
# the EOS version is older than 4.30, the correct regional URL where the CVaaS tenant is deployed
# must be used. The following are the cluster URLs used in production:
# United States 1a: "www.arista.io"
# United States 1b: "www.cv-prod-us-central1-b.arista.io"
# United States 1c: "www.cv-prod-us-central1-c.arista.io"
Expand Down Expand Up @@ -346,6 +347,7 @@ class BootstrapManager( object ):
self.bootstrapURL = self.getBootstrapURL( assignment )
except Exception as e:
log("No assignment found. Error talking to redirector - %s" % e )
raise e

def getBootstrapScript( self ):
# setting Sysdb access variables
Expand All @@ -355,7 +357,6 @@ class BootstrapManager( object ):
# sysdb paths accessed
cellID = str( Cell.cellId() )
mibStatus = pathHelper.getEntity( "hardware/entmib" )
tpmStatus = pathHelper.getEntity( "cell/" + cellID + "/hardware/tpm/status" )

# setting header information
headers = {}
Expand All @@ -364,9 +365,13 @@ class BootstrapManager( object ):
headers[ 'X-Arista-HardwareVersion' ] = mibStatus.root.hardwareRev
headers[ 'X-Arista-Serial' ] = mibStatus.root.serialNum

headers[ 'X-Arista-TpmApi' ] = tpmStatus.tpmVersion
headers[ 'X-Arista-TpmFwVersion' ] = tpmStatus.firmwareVersion
headers[ 'X-Arista-SecureZtp' ] = str( tpmStatus.boardValidated )
try:
tpmStatus = pathHelper.getEntity( "cell/" + cellID + "/hardware/tpm/status" )
headers[ 'X-Arista-TpmApi' ] = tpmStatus.tpmVersion
headers[ 'X-Arista-TpmFwVersion' ] = tpmStatus.firmwareVersion
headers[ 'X-Arista-SecureZtp' ] = str( tpmStatus.boardValidated )
except Exception as e:
log("Exception while getting device tpmStatus: %s" % e)

headers[ 'X-Arista-SoftwareVersion' ] = getValueFromFile(
"/etc/swi-version", "SWI_VERSION" )
Expand Down

0 comments on commit c871943

Please sign in to comment.