5
5
6
6
ERR_MSG_IP_FAILURE = "does not appear to be an IPv4 or IPv6 network"
7
7
ERR_MSG_IP_VERSION_FAILURE = "not a valid IPv4 address"
8
+ ERR_MSG_GRE_TYPE_FAILURE = "not a valid GRE type"
8
9
ERR_MSG_VALUE_FAILURE = "Invalid value for"
9
10
10
11
def test_mirror_session_add ():
@@ -50,7 +51,13 @@ def test_mirror_session_add():
50
51
config .config .commands ["mirror_session" ].commands ["add" ],
51
52
["test_session" , "1.1.1.1" , "2.2.2.2" , "6" , "63" , "65536" , "100" ])
52
53
assert result .exit_code != 0
53
- assert ERR_MSG_VALUE_FAILURE in result .stdout
54
+ assert ERR_MSG_GRE_TYPE_FAILURE in result .stdout
55
+
56
+ result = runner .invoke (
57
+ config .config .commands ["mirror_session" ].commands ["add" ],
58
+ ["test_session" , "1.1.1.1" , "2.2.2.2" , "6" , "63" , "abcd" , "100" ])
59
+ assert result .exit_code != 0
60
+ assert ERR_MSG_GRE_TYPE_FAILURE in result .stdout
54
61
55
62
# Verify invalid queue
56
63
result = runner .invoke (
@@ -67,6 +74,11 @@ def test_mirror_session_add():
67
74
68
75
mocked .assert_called_with ("test_session" , "100.1.1.1" , "2.2.2.2" , 8 , 63 , 10 , 100 , None )
69
76
77
+ result = runner .invoke (
78
+ config .config .commands ["mirror_session" ].commands ["add" ],
79
+ ["test_session" , "100.1.1.1" , "2.2.2.2" , "8" , "63" , "0X1234" , "100" ])
80
+
81
+ mocked .assert_called_with ("test_session" , "100.1.1.1" , "2.2.2.2" , 8 , 63 , 0x1234 , 100 , None )
70
82
71
83
72
84
def test_mirror_session_erspan_add ():
@@ -112,7 +124,13 @@ def test_mirror_session_erspan_add():
112
124
config .config .commands ["mirror_session" ].commands ["erspan" ].commands ["add" ],
113
125
["test_session" , "1.1.1.1" , "2.2.2.2" , "6" , "63" , "65536" , "100" ])
114
126
assert result .exit_code != 0
115
- assert ERR_MSG_VALUE_FAILURE in result .stdout
127
+ assert ERR_MSG_GRE_TYPE_FAILURE in result .stdout
128
+
129
+ result = runner .invoke (
130
+ config .config .commands ["mirror_session" ].commands ["erspan" ].commands ["add" ],
131
+ ["test_session" , "1.1.1.1" , "2.2.2.2" , "6" , "63" , "abcd" , "100" ])
132
+ assert result .exit_code != 0
133
+ assert ERR_MSG_GRE_TYPE_FAILURE in result .stdout
116
134
117
135
# Verify invalid queue
118
136
result = runner .invoke (
@@ -129,6 +147,12 @@ def test_mirror_session_erspan_add():
129
147
130
148
mocked .assert_called_with ("test_session" , "100.1.1.1" , "2.2.2.2" , 8 , 63 , 10 , 100 , None , None , None )
131
149
150
+ result = runner .invoke (
151
+ config .config .commands ["mirror_session" ].commands ["erspan" ].commands ["add" ],
152
+ ["test_session" , "100.1.1.1" , "2.2.2.2" , "8" , "63" , "0x1234" , "100" ])
153
+
154
+ mocked .assert_called_with ("test_session" , "100.1.1.1" , "2.2.2.2" , 8 , 63 , 0x1234 , 100 , None , None , None )
155
+
132
156
133
157
def test_mirror_session_span_add ():
134
158
runner = CliRunner ()
0 commit comments