# zapiFirmwareUpgrade
## 1. Online upgrade
### 1.1 Get firmware info from rms site
***Should start xmpp server before this command**
> #### Get config with zapi-cli
> #### Input json
```jsonld=
{
"rpc": {
"message-id": 102,
"operation": "rpc",
"xmlns": "urn:ietf:params:xml:ns:netconf:base:1.0",
"params": {
"on-line-check-rms": {
"input": {
"zapi-version": "4"
}
},
"xmlns": "urn:zyxel:cpe:system:zyxel-system-firmware-upgrade",
"root": "on-line-check-rms"
}
}
}
```
> #### Output result
```jsonld=
{
"rpc-reply": {
"xmlns": "urn:ietf:params:xml:ns:netconf:base:1.0",
"result": "ok",
"message-id": 102,
"data": [
{
"on-line-check-rms": {
"output": {
"firmware-list": [
{
"release-date": "2019-06-06",
"index": "1",
"firmware-md5": "6af82d87379deb8b32561bece6f8db6e",
"firmware-url": "https://d370xk6ryl6fxf.cloudfront.net/mycloud/nbg6818/latest_firmware_info/s3_file/1559804121150/V1.00(ABSC.0)B1_test_02.bin",
"release-note-url": "",
"build-number": "1559803258",
"zapi-version": "6",
"version": "V1.00(ABSC.0)B1_test_02",
"ieee-1905-version": "1",
"firmware-size": "18566717",
"model-name": "NBG6818"
}
],
"result": "NULL"
}
},
"xmlns": "urn:zyxel:cpe:system:zyxel-system-firmware-upgrade",
"root": "on-line-check-rms"
}
]
}
}
```
> #### Output 檢查重點
***Only model-name should be same with two diffent firmware version**
```jsonld=
{
"release-date": "2019-06-06",
"index": "1",
"firmware-md5": "6af82d87379deb8b32561bece6f8db6e",
"firmware-url": "https://d370xk6ryl6fxf.cloudfront.net/mycloud/nbg6818/latest_firmware_info/s3_file/1559804121150/V1.00(ABSC.0)B1_test_02.bin",
"release-note-url": "",
"build-number": "1559803258",
"zapi-version": "6",
"version": "V1.00(ABSC.0)B1_test_02",
"ieee-1905-version": "1",
"firmware-size": "18566717",
"model-name": "NBG6818"
}
```
### 1.2 Start online upgrade
***Should get firmware info from rms before this command**
> #### Get config with zapi-cli
> #### Input json
```jsonld=
{
"rpc": {
"message-id": 102,
"operation": "rpc",
"xmlns": "urn:ietf:params:xml:ns:netconf:base:1.0",
"params": {
"on-line-upgrade": {},
"xmlns": "urn:zyxel:cpe:system:zyxel-system-firmware-upgrade",
"root": "on-line-upgrade"
}
}
}
```
> #### Output result
***After start upgrade should check upgrade status to know success or not**
```jsonld=
{
"rpc-reply": {
"xmlns": "urn:ietf:params:xml:ns:netconf:base:1.0",
"result": "ok",
"message-id": 102,
"data": [
{
"upgrade-status": {
"output": {
"status": "Writing"
}
},
"xmlns": "urn:zyxel:cpe:system:zyxel-system-firmware-upgrade",
"root": "upgrade-status"
}
]
}
}
```
### 1.3 Check firmware upgrade status
***status 有下列六種
"Downloading"
"Writing"
"Syncing"
"Rebooting"
"Fail"**
> #### Get config with zapi-cli
> #### Input json
```jsonld=
{
"rpc": {
"message-id": 102,
"operation": "rpc",
"xmlns": "urn:ietf:params:xml:ns:netconf:base:1.0",
"params": {
"upgrade-status": {},
"xmlns": "urn:zyxel:cpe:system:zyxel-system-firmware-upgrade",
"root": "upgrade-status"
}
}
}
```
> #### Output result
```jsonld=
{
"rpc-reply": {
"xmlns": "urn:ietf:params:xml:ns:netconf:base:1.0",
"result": "ok",
"message-id": 102,
"data": [
{
"upgrade-status": {
"output": {
"status": "Writing"
}
},
"xmlns": "urn:zyxel:cpe:system:zyxel-system-firmware-upgrade",
"root": "upgrade-status"
}
]
}
}
```
## 2. Upload firmware and upgrade
TO BE CONTINUE