Hazard's stuff

Huawei OPS syslog example

— Posted by hazard @ 2023-06-29 10:54
Documentation from the Huawei site gives non-working examples and wrong names of parameters for OPS syslog logging. Below are syslog calls that actually work:
import ops

def ops_condition(_ops):
    status, err_log = _ops.syslog("Hello world", ops.INFORMATIONAL, ops.SYSLOG)
    status, err_log = _ops.syslog("Example critical error", ops.CRITICAL, ops.SYSLOG)


Example Huawei OPS route monitoring script that changes VXLAN VTEP configuration if route goes away

— Posted by hazard @ 2023-06-17 23:42
To avoid using peer-link between Huawei CloudEngine switches in PtP VXLAN environment and therefore save 4 x 100G ports, I made a Python script for Huawei OPS that changes VTEP peer IP in case route to primary VTEP disappears (e.g. primary switch fails). It was much more of an effort than it should been, due to inadequate API documentation & examples which sometimes specify wrong parameter values. Non-working Python error reporting on Huawei VRP (at least on OS release I used) didn't help either. Details below. (More)