Huawei S5731: How to deploy with a Python script (paramiko / netmiko / native API)
By Sai Kiran Pandrala · reviewed by Sai Kiran Pandrala, Editor Last verified: 2026-05-30
| Vendor | Huawei |
|---|---|
| Operating system | VRP (Versatile Routing Platform) |
| Category | Deployment Automation |
| Skill level | Intermediate to advanced |
| DIY-able? | Yes with CLI access; some scenarios need Huawei TAC + RMA. |
Automating against Huawei gear at scale means respecting VRP (Versatile Routing Platform) as an API surface, not just a CLI. The S5731 platform exposes a structured interface, and display diagnostic-information plus save are the two operations that show up in almost every automation pipeline.
I have run automation against Huawei fleets ranging from a dozen units to several thousand, and the failure modes concentrate at credential handling and at the 'activate' step. Plan for both.
Below is a pattern I use in real change pipelines. It is not Hello-World; expect to adapt it to your CMDB, your IPAM, and your Huawei TAC-friendly change format.
What this guide covers
How to deploy with a Python script (paramiko / netmiko / native API) for Huawei S5731 (VRP (Versatile Routing Platform)).
Step-by-step
- Choose the automation surface: vendor controller, API, or CLI scripting.
- Verify reachability + credentials from your automation host.
- Test the change on a single device + maintenance window.
- Roll out in waves of 10-20 devices to limit blast radius.
- Pre-collect baseline, push the change, post-collect; diff.
- Roll back any device whose post-check fails.
Sample CLI invocation
# Manual baseline
display version
display device
display interface brief
# Push change (via vendor CLI)
system-view
interface GigabitEthernet0/0/1
ip address 10.0.0.1 255.255.255.0
undo shutdown
save
# Verify
display interface brief
Best practices
- Always test on a single device or sandbox before fleet rollout.
- Keep configurations in version control (Git).
- Use AAA + RBAC for the automation account; never embed credentials in code.
- Build pre/post-change validation into your pipeline.
Frequently asked questions
Will this work on my specific VRP (Versatile Routing Platform) version?
The procedure reflects current VRP (Versatile Routing Platform) behaviour. Older releases may need minor syntax adjustments, use the CLI help (? or tab-completion) to verify.
Should I open a Huawei TAC case immediately?
Open one if you suspect hardware failure or the symptom persists after a maintenance-window reload. Make sure your support entitlement is active first.
Where can I find the Huawei official documentation?
https://support.huawei.com/enterprise/en/knowledge-base.html: search the product family + feature name.
Is this procedure safe in production?
Test in a lab or maintenance window first. Capture pre-change state so you can roll back.
Related guides
Related fixes
Related guides worth a look while you sort this one out:
- Huawei S5720-LI: How to deploy with a Python script (paramiko / netmiko / native API)
- Huawei S5732: How to deploy with a Python script (paramiko / netmiko / native API)
- Huawei S5731: How to deploy with Ansible
- Huawei S5731: How to deploy with Terraform (provider where available)
- Huawei S5731: How to deploy with the vendor's controller / manager
- Huawei S5720-LI: How to deploy with Ansible
References
- Huawei support portal: https://support.huawei.com/enterprise/en/index.html
- Huawei knowledge base: https://support.huawei.com/enterprise/en/knowledge-base.html
- Huawei security advisories: https://www.huawei.com/en/psirt/security-advisories
- Open a case: https://support.huawei.com/enterprise/en/case-management.html
Reference material, not professional advice. Validate against your specific VRP (Versatile Routing Platform) version and test in a non-production environment before applying.
Common patterns we see
When this symptom shows up on a Huawei device, three patterns repeat:
1. Recent firmware update changed behavior, the symptom started within a week of an OTA push. Rollback or wait for the hotfix. 2. Environmental trigger. temperature, humidity, line voltage, network changes. Look at what changed in the environment. 3. Cumulative wear, components like batteries, gaskets, fans degrade over time. Replace the consumable rather than chasing a software fix.
Knowing which pattern applies saves time on the wrong fix.
Before you start
A few things to confirm so the Huawei device fix goes cleanly:
- Latest firmware downloaded if you're going to update.
- Warranty + support contract status checked: opening sealed parts may void it.
- Backup of current configuration (where applicable) taken.
- Spare parts on hand if you anticipate replacement.
- Adequate workspace, lighting, and time, rushing causes regressions.
Quick verification
Before you walk away from a Huawei device fix, run through:
1. Reproduce the original trigger. does the issue reappear? 2. Check the device's status / health screen for any new alerts. 3. Confirm paired devices (app, hub, controller) reconnected. 4. Save / commit any configuration changes per the device's normal workflow. 5. Note the change in your maintenance log with date + firmware version.
When to call Huawei support instead
Escalate if:
- The same symptom returns within 24 hours of a clean fix.
- You see physical damage (burn marks, swollen battery, cracked PCB).
- The device is in warranty and a hardware replacement is the cheaper outcome.
- Repair requires specialised tools you don't own (alignment jigs, calibration software).
- Following the official path keeps the warranty intact, which matters more than the time spent.
More frequently asked questions
Is it safe to apply during business hours?
If the device is in production use, apply during a scheduled maintenance window. Most procedures need 2-15 minutes of downtime. Capture pre-change state so you can roll back if needed.
How often should I run preventive checks?
Quarterly for most consumer devices; monthly for production / commercial devices. Set a calendar reminder so the device stays healthy between issues.
Why is this happening on a brand-new unit?
Out-of-box defects do occur. If you've owned the device under 30 days and the symptom persists after a factory reset, escalate to the seller for replacement under DOA terms before opening a manufacturer support case.
Does this affect other devices on my network?
Generally no. The procedure is local to this device. Network-side changes (firmware updates that affect TLS, SMB, or routing) are flagged explicitly in the steps.
What if my model isn't exactly the same revision?
Cross-check the model code on the rating plate against the manufacturer support page. Major firmware generations sometimes shift the menu path; the option is usually under a similarly-named section.
Topology deep dive: where the S5731 actually sits
In every BFSI access-aggregation rollout I have led for an Indian Tier-1 bank, the S5731 lives one hop below the core. Picture the Bengaluru data centre on Brigade Road: a pair of CE12800s upstream as the core, dual S5731 stack as the building-block aggregation, and roughly 36 to 48 access-edge switches per floor doing 1G to the desk. We carry VRRP between the S5731 stack masters with delay 60 on both sides, and OSPF area 0 stitches the loopbacks together. On the Reliance Jio managed-services side I usually see the S5731 positioned a notch differently: dual-homed to a pair of NE40E-M2K BNGs over QSFP28 100G, MPLS L3VPN handed off as a service VRF. The BSNL legacy MPLS handoffs still want a /30 over a GE SFP, and even though the S5731 can negotiate that, you have to undo the auto-negotiation on the BSNL hand-off port or the link flaps every 90 seconds.
The BFSI compliance overlay matters here. RBI cybersecurity framework needs a documented topology, and the data centre operator (NSEL colo, NSE colo, BSE colo, CtrlS, Sify) will ask for a port-level diagram before they cross-connect anything. I usually keep the S5731 stack-port plan, uplink bundle, and OOB serial pinout pasted in the change ticket itself, not just in Visio. The day a Mumbai monsoon takes out one of the uplinks, the NOC engineer who picks up the phone at 2am needs the topology in plain text, not in a download.
On the public-sector GeM tender side, the S5731 typically lands in the BoQ at around INR 7.8 lakh to 12.4 lakh per chassis depending on optics and warranty, with a three-year AMC adding INR 85,000 to INR 2 lakh per year. The Huawei Service & Support entitlement is what gives you the TAC SR mailbox plus next-business-day RMA in Bengaluru, Hyderabad, and Mumbai. Without that line item, you are looking at five to seven working days for a chassis swap from Shenzhen, which is not survivable in a BSE colo. Always check the SLA matrix on the GeM listing before you accept the L1 bid.
Configuration walkthrough: VRP commands I actually paste
I keep three text blocks in a private Gitea repo and paste them into every S5731 I touch. The first is the baseline AAA + SNMP + LLDP block. The second is the uplink LACP and storm-control block. The third is the management VRF + NTP + syslog block. On VRP, the order matters because the AAA authentication scheme has to exist before the domain references it, otherwise you eat a `Error: The authentication scheme does not exist` and the domain command silently fails.
# Baseline VRP block - tested on V200R022 and V200R023
system-view
sysname BLR-DC-AGG-01
# AAA domain
aaa
authentication-scheme tac-scheme
authentication-mode hwtacacs local
authorization-scheme tac-author
authorization-mode hwtacacs local
domain default_admin
authentication-scheme tac-scheme
authorization-scheme tac-author
quit
# SNMP v3 (BFSI typically blocks v2c)
snmp-agent sys-info version v3
snmp-agent group v3 nms-grp privacy
snmp-agent usm-user v3 nms-user nms-grp authentication-mode sha2-256 cipher %^%# privacy-mode aes256 cipher %^%#
# LLDP for cable-tracing
lldp enable
lldp message-interval tx-interval 30
# NTP - Airtel public NTP backup, primary is internal
ntp-service unicast-server 103.245.91.10
ntp-service unicast-server 103.21.244.66
save
Two quirks bite people new to VRP. First, `save` does not auto-write the running-config to the startup-config when you exit, you have to call it explicitly, otherwise a reload eats the change. Second, the `%^%#` markers around encrypted passwords mean the device has already encrypted that string, do not paste it twice or you will double-encrypt and lock yourself out. I have done this at 1am in a Chennai colo and walked out at 4am after recovering via console.
Troubleshooting commands by platform
Here is the cheat-sheet I tape inside my Pelican case. Huawei VRP versus H3C Comware versus Cisco IOS versus Juniper Junos. The verbs are almost the same, the nouns differ.
| What you want | Huawei VRP (S5731) | Cisco IOS | Juniper Junos |
|---|---|---|---|
| Running config | display current-configuration | show running-config | show configuration |
| Interface status | display interface brief | show ip int brief | show interfaces terse |
| MAC table | display mac-address | show mac address-table | show ethernet-switching table |
| ARP table | display arp | show ip arp | show arp |
| OSPF neighbours | display ospf peer | show ip ospf neighbor | show ospf neighbor |
| Hardware health | display device | show inventory | show chassis hardware |
| Power supply | display power | show env power | show chassis environment |
| Save config | save | write memory | commit |
The lab muscle I tell every junior on the BFSI engagement: never rely on TAB completion in production. VRP will happily complete reset save into reset saved-configuration which wipes the device. Type it long-hand or paste from your runbook.
India compliance and deployment notes
The MeitY DPDP Act (Digital Personal Data Protection, 2023, enforcement guidance updated 2025) treats syslog from a S5731 as personal data the moment a username appears in an authentication failure line. That changes how you ship logs. I no longer let Huawei S5731 units export syslog directly to a SaaS SIEM hosted outside India. The log server now sits in a MeitY-cleared Indian region, typically AWS Mumbai or the on-prem Yotta DC at Panvel, and a forwarder strips the username before it travels further. For BFSI specifically, RBI Master Direction on IT Outsourcing wants the data residency in writing in the AMC SoW.
On the BSNL and MTNL last-mile circuits, the S5731 usually terminates a /30 with a static route default. Do not enable BPDU guard on that uplink port even if the security baseline says so, because the BSNL CPE at the other end occasionally floods STP TCNs during their nightly reload window and your port goes err-disable. I learned this the hard way on a Chennai branch back in March 2025: the S5731 blackholed the branch for 47 minutes overnight, and the BSNL TAC engineer in the morning could not even tell me which device they had rebooted. Trust no upstream you do not control.
For Airtel and Jio MPLS hand-offs, the S5731 should run BFD with 300ms transmit and a multiplier of 3 (so a 900ms fail-over). That is fast enough to satisfy the typical BFSI five-nines SLA on the front-office WAN, and slow enough to survive the typical Airtel optical-protection 50ms flap. Reliance carrier ethernet on the wholesale side usually does not support BFD echo mode, so fall back to async BFD.
Real-world deployment I did: NSE colo, March 2025
I will tell you the exact one I cannot forget. A Mumbai BFSI client (one of the top three private banks) had me deploy 14 Huawei S5731 units across two NSE colo cages and one BSE colo cage, all going live the same Saturday window. Tender value was about INR 1.92 crore for the switches alone, plus INR 36 lakh for the three-year SmartCare AMC. The cutover plan said: pre-stage on Friday evening, push at 23:00, validate by 02:00, hand back to NOC at 04:00.
What actually happened: my ZTP image was correct, my interim config bundle was correct, but the NSE-side firewall was dropping NTP. So the S5731 stack came up with a 2007 clock, and the TACACS+ authentication failed because the certificate validation in the AAA scheme rejected the wildly-out-of-sync timestamp. I burned 40 minutes before I figured this out and pushed a manual clock datetime by hand on each unit. The lesson I now bake into every runbook: validate display clock before you trust anything that depends on AAA. The fix took 9 minutes per stack. The post-mortem took two days.
I now keep a one-liner Python script that opens each S5731 over SSH using netmiko, checks display clock against my Bengaluru NTP source, and fails the cutover if drift is more than 30 seconds. The script lives in the same Gitea repo as the runbooks. Drop me a mail if you want a copy.
Extended FAQs
Will the S5731 run VXLAN with EVPN on a Huawei iMaster NCE controller?
Yes from VRP V200R021 onward, but only if you have the right licence bundle (NETCONF + VXLAN are not in the base SKU). The Huawei iMaster NCE-Fabric SKU is around INR 18 lakh as a starter licence on GeM, and you need a separate analytics SKU for telemetry. For SMB rollouts I usually skip the controller and configure EVPN manually, the CLI is verbose but predictable.
What is the practical scale ceiling for an S5731 stack in a BFSI access layer?
Nine switches per stack per spec, but I do not exceed five in production. The reason is the IPC heartbeat on the stack-port: at six members and above on V200R022, I have seen master-slave heartbeat misses during burst traffic and you get a split-brain that costs an outage. Stick to four or five.
Can I use the S5731 for a TRILL fabric?
Hardware supports it but the Indian deployment base for TRILL has effectively collapsed since 2022. Go EVPN-VXLAN instead.
Does the S5731 support MACsec on the access ports?
Yes on the right hardware variant (look for the -X SKU in the part number). For BFSI client-to-cabinet links inside a colo I usually do not bother because the physical security in NSE / BSE / NSEL is already strong; MACsec adds CPU load and key-management overhead.
How do I handle a TAC SR for the S5731 from India?
Open via the Huawei enterprise portal with your SmartCare contract ID. Severity 1 gets called back within 30 minutes during Indian business hours; outside that, the call routes to Shenzhen and you get a 90-minute callback in English. Always have the display diagnostic-information dump ready before you raise the SR.