diff --git a/pkg/device/huawei/huawei.go b/pkg/device/huawei/huawei.go index 220ad2d..ee15ac1 100644 --- a/pkg/device/huawei/huawei.go +++ b/pkg/device/huawei/huawei.go @@ -26,7 +26,7 @@ const ( `|Error(?:\[\d+\])?:\s*(?P.+?)` + `)` passwordExpression = `(\r\n|^)Password:$` - passwordErrorExpression = `.*Error: Username or password error\.\r\n$|.*Authentication fail(\x00\r\n)?$|Error: The password is invalid.\r\n$` + passwordErrorExpression = `.*(Error: Username or password error\.\r\n|.*Authentication fail(\x00\r\n)?|Error: The password is invalid.\r\n|Error: Authentication fail)(\r\n|$)` pagerExpression = `(?P(\r\n|\n))? ---- More ----$` ) diff --git a/pkg/device/huawei/huawei_test.go b/pkg/device/huawei/huawei_test.go index f9cb283..42e0ad0 100644 --- a/pkg/device/huawei/huawei_test.go +++ b/pkg/device/huawei/huawei_test.go @@ -51,3 +51,10 @@ func TestHuaweiQuestion(t *testing.T) { } testutils.ExprTester(t, errorCases, questionExpression) } + +func TestAuthError(t *testing.T) { + errorCases := [][]byte{ + []byte("\r\nError: Authentication fail\r\n"), // followed by User interface con0 is available, console + } + testutils.ExprTester(t, errorCases, passwordErrorExpression) +}