Skip to content

Commit

Permalink
Fix exception in adding mirror_session when gre_type is absent (#2458)
Browse files Browse the repository at this point in the history
This PR is to fix the exception in adding mirror session when gre_type is absent.
  • Loading branch information
bingwang-ms committed Oct 27, 2022
1 parent 7e7d05c commit 4a3d49d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,8 @@ def validate_ipv4_address(ctx, param, ip_addr):
def validate_gre_type(ctx, _, value):
"""A validator for validating input gre_type
"""
if value is None:
return None
try:
base = 10
if value.lower().startswith('0x'):
Expand Down
6 changes: 6 additions & 0 deletions tests/config_mirror_session_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ def test_mirror_session_add():
["test_session", "100.1.1.1", "2.2.2.2", "8", "63", "0", "0"])

mocked.assert_called_with("test_session", "100.1.1.1", "2.2.2.2", 8, 63, 0, 0, None)

result = runner.invoke(
config.config.commands["mirror_session"].commands["add"],
["test_session", "100.1.1.1", "2.2.2.2", "8", "63"])

mocked.assert_called_with("test_session", "100.1.1.1", "2.2.2.2", 8, 63, None, None, None)


def test_mirror_session_erspan_add():
Expand Down

0 comments on commit 4a3d49d

Please sign in to comment.