-
Notifications
You must be signed in to change notification settings - Fork 680
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[show][vrf]Fixing show vrf to include vlan subinterface (#2158)
* [show][vrf]Fixing show vrf to include vlan subinterface
- Loading branch information
1 parent
7a06457
commit a73f156
Showing
4 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
import sys | ||
from click.testing import CliRunner | ||
from swsscommon.swsscommon import SonicV2Connector | ||
from utilities_common.db import Db | ||
|
||
import show.main as show | ||
|
||
test_path = os.path.dirname(os.path.abspath(__file__)) | ||
mock_db_path = os.path.join(test_path, "vrf_input") | ||
|
||
class TestShowVrf(object): | ||
@classmethod | ||
def setup_class(cls): | ||
print("SETUP") | ||
os.environ["UTILITIES_UNIT_TESTING"] = "1" | ||
|
||
def test_vrf_show(self): | ||
from .mock_tables import dbconnector | ||
jsonfile_config = os.path.join(mock_db_path, "config_db") | ||
dbconnector.dedicated_dbs['CONFIG_DB'] = jsonfile_config | ||
runner = CliRunner() | ||
db = Db() | ||
expected_output = """\ | ||
VRF Interfaces | ||
------ --------------- | ||
Vrf1 | ||
Vrf101 Ethernet0.10 | ||
Vrf102 PortChannel0002 | ||
Vlan40 | ||
Eth32.10 | ||
Vrf103 Ethernet4 | ||
Loopback0 | ||
""" | ||
|
||
result = runner.invoke(show.cli.commands['vrf'], [], obj=db) | ||
dbconnector.dedicated_dbs = {} | ||
assert result.exit_code == 0 | ||
assert result.output == expected_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"VLAN_SUB_INTERFACE|Ethernet0.10": { | ||
"vrf_name": "Vrf101", | ||
"admin_status": "up" | ||
}, | ||
"VLAN_SUB_INTERFACE|Eth32.10": { | ||
"vrf_name": "Vrf102", | ||
"admin_status": "up", | ||
"vlan": "100" | ||
}, | ||
"VLAN_INTERFACE|Vlan40": { | ||
"vrf_name": "Vrf102" | ||
}, | ||
"PORTCHANNEL_INTERFACE|PortChannel0002": { | ||
"vrf_name": "Vrf102" | ||
}, | ||
"INTERFACE|Ethernet4": { | ||
"vrf_name": "Vrf103" | ||
}, | ||
"LOOPBACK_INTERFACE|Loopback0": { | ||
"vrf_name": "Vrf103" | ||
}, | ||
"VRF|Vrf1": { | ||
"fallback": "false" | ||
}, | ||
"VRF|Vrf101": { | ||
"NULL": "NULL" | ||
}, | ||
"VRF|Vrf102": { | ||
"NULL": "NULL" | ||
}, | ||
"VRF|Vrf103": { | ||
"NULL": "NULL" | ||
} | ||
} |