Skip to content

Commit

Permalink
Adding UT
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsudharsan committed Nov 17, 2022
1 parent 01796d2 commit 5be7c2c
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/mock_tables/appl_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,16 @@
"VXLAN_REMOTE_VNI_TABLE:Vlan200:25.25.25.27": {
"vni": "200"
},
"VXLAN_FDB_TABLE:Vlan200:00:02:00:00:47:e2": {
"remote_vtep": "2.2.2.2",
"type": "dynamic",
"vni": "200"
},
"VXLAN_FDB_TABLE:Vlan200:00:02:00:00:47:e3": {
"remote_vtep": "2.2.2.3",
"type": "dynamic",
"vni": "200"
},
"MUX_CABLE_TABLE:Ethernet32": {
"state": "active"
},
Expand Down
64 changes: 64 additions & 0 deletions tests/vxlan_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,38 @@
"""

show_vxlan_remotemac_all_output="""\
+---------+-------------------+--------------+-------+---------+
| VLAN | MAC | RemoteVTEP | VNI | Type |
+=========+===================+==============+=======+=========+
| Vlan200 | 00:02:00:00:47:e2 | 2.2.2.2 | 200 | dynamic |
+---------+-------------------+--------------+-------+---------+
| Vlan200 | 00:02:00:00:47:e3 | 2.2.2.3 | 200 | dynamic |
+---------+-------------------+--------------+-------+---------+
Total count : 2
"""

show_vxlan_remotemac_specific_output="""\
+---------+-------------------+--------------+-------+---------+
| VLAN | MAC | RemoteVTEP | VNI | Type |
+=========+===================+==============+=======+=========+
| Vlan200 | 00:02:00:00:47:e2 | 2.2.2.2 | 200 | dynamic |
+---------+-------------------+--------------+-------+---------+
Total count : 1
"""

show_vxlan_remotemac_cnt_output="""\
Total count : 2
"""

show_vxlan_remotemac_specific_cnt_output="""\
Total count : 1
"""

class TestVxlan(object):
@classmethod
def setup_class(cls):
Expand Down Expand Up @@ -215,6 +247,38 @@ def test_show_vxlan_remotevni_specific_cnt(self):
assert result.exit_code == 0
assert result.output == show_vxlan_remotevni_specific_cnt_output

def test_show_vxlan_remotemac(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["vxlan"].commands["remotemac"], ["all"])
print(result.exit_code)
print(result.output)
assert result.exit_code == 0
assert result.output == show_vxlan_remotemac_all_output

def test_show_vxlan_remotemac_specific(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["vxlan"].commands["remotemac"], ["2.2.2.2"])
print(result.exit_code)
print(result.output)
assert result.exit_code == 0
assert result.output == show_vxlan_remotemac_specific_output

def test_show_vxlan_remotemac_cnt(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["vxlan"].commands["remotemac"], ["all", "count"])
print(result.exit_code)
print(result.output)
assert result.exit_code == 0
assert result.output == show_vxlan_remotemac_cnt_output

def test_show_vxlan_remotemac_specific_cnt(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["vxlan"].commands["remotemac"], ["2.2.2.2", "count"])
print(result.exit_code)
print(result.output)
assert result.exit_code == 0
assert result.output == show_vxlan_remotemac_specific_cnt_output

def test_config_vxlan_add(self):
runner = CliRunner()
db = Db()
Expand Down

0 comments on commit 5be7c2c

Please sign in to comment.