Skip to content

Commit 4a3d49d

Browse files
authored
Fix exception in adding mirror_session when gre_type is absent (#2458)
This PR is to fix the exception in adding mirror session when gre_type is absent.
1 parent 7e7d05c commit 4a3d49d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

config/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,8 @@ def validate_ipv4_address(ctx, param, ip_addr):
11431143
def validate_gre_type(ctx, _, value):
11441144
"""A validator for validating input gre_type
11451145
"""
1146+
if value is None:
1147+
return None
11461148
try:
11471149
base = 10
11481150
if value.lower().startswith('0x'):

tests/config_mirror_session_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ def test_mirror_session_add():
8585
["test_session", "100.1.1.1", "2.2.2.2", "8", "63", "0", "0"])
8686

8787
mocked.assert_called_with("test_session", "100.1.1.1", "2.2.2.2", 8, 63, 0, 0, None)
88+
89+
result = runner.invoke(
90+
config.config.commands["mirror_session"].commands["add"],
91+
["test_session", "100.1.1.1", "2.2.2.2", "8", "63"])
92+
93+
mocked.assert_called_with("test_session", "100.1.1.1", "2.2.2.2", 8, 63, None, None, None)
8894

8995

9096
def test_mirror_session_erspan_add():

0 commit comments

Comments
 (0)