Darshan Maiya

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Scripting firmware upgrade MTC #31557
    Darshan Maiya
    Blocked

    Here is the script I generally use to commission and upgrade units

    #! /bin/bash
    #check commissioning mode
    ##script tested using ubuntu
    set -e
    
    curl -k "https://192.168.2.1/api/commissioning" 
    
    ##set username 
    aas_ID=$(curl -k -X POST -H "Content-Type: json/apaas_IDplication" -d '{"username":"admin", "aasID": "", "aasAnswer":""}' https://192.168.2.1:443/api/commissioning | jq -r '.result.aasID' )
    ##set password
    curl -k -X POST -H "Content-Type: json/application" -d '{"username":"admin", "aasID":"'"$aas_ID"'", "aasAnswer":"Admin123"}' https://192.168.2.1:443/api/commissioning
    ##confirm password
    curl -k -X POST -H "Content-Type: json/application" -d '{"username":"admin", "aasID":"'"$aas_ID"'", "aasAnswer":"Admin123"}' https://192.168.2.1:443/api/commissioning
    
    ##log in and save token 
    token=$(curl -k "https://192.168.2.1/api/login?username=admin&password=Admin123"| jq -r '.result.token' )
    
    curl -k -X POST -H "Content-Type: json/application" -d '{"info":{"fileName":"conduit_5.3.0_upgrade-signed.bin","fileSize":81674240}}' https://192.168.2.1/api/command/firmware_pre_upgrade?token=$token
    curl -i -k -b /tmp/headers --http1.0 -F file=@conduit_5.3.0_upgrade-signed.bin "https://192.168.2.1/api/command/firmware_check?token=$token"
    curl -k -X POST -H "Content-Type: json/application" -d '' https://192.168.2.1/api/command/firmware_upgrade?token=$token
    
    sleep 12m
    
    token1=$(curl -k "https://192.168.2.1/api/login?username=admin&password=Admin123"| jq -r '.result.token' )
    
    #factory reset back to comissioning mode
    curl -k -X POST -d "" https://192.168.2.1/api/command/restore_defaults?token=$token1
    • This reply was modified 3 years, 3 months ago by Darshan Maiya.
Viewing 1 post (of 1 total)