Skip to content

Commit

Permalink
Update get_config method signature, handle mock attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jbemmel committed May 4, 2024
1 parent 826a89c commit b24e2e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions napalm_sros/sros.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ def get_config(
retrieve="all",
full=False,
sanitized=False,
format="text",
):
"""
Return the configuration of a device.
Expand All @@ -1128,7 +1129,7 @@ def get_config(
"""
try:
configuration = {"running": "", "candidate": "", "startup": ""}
if self.sros_get_format == "cli" and (sanitized is True or sanitized is False):
if self.sros_get_format == "cli" or format == "cli":
# Getting output in MD-CLI format
# retrieving config using md-cli
cmd_running = "admin show configuration | no-more"
Expand Down Expand Up @@ -1190,7 +1191,7 @@ def _update_buff(buff):
return configuration

# returning the config in xml format
elif self.sros_get_format == "xml" and (sanitized is True or sanitized is False):
elif self.sros_get_format == "xml" or format == "xml":
config_data_running_xml = ""
if retrieve == "running" or retrieve == "all":
config_data_running = to_ele(
Expand Down
1 change: 1 addition & 0 deletions test/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class FakeNokiaSROSDevice(BaseTestDouble):
def __init__(self):
self.get = FakeGetMethod(self)
self.get_config = FakeGetConfigMethod(self)
self.server_capabilities = []

def open(self):
pass
Expand Down

0 comments on commit b24e2e3

Please sign in to comment.