diff --git a/lib/ansible/modules/network/cli/cli_config.py b/lib/ansible/modules/network/cli/cli_config.py index 9f847db112..a4de544f2b 100644 --- a/lib/ansible/modules/network/cli/cli_config.py +++ b/lib/ansible/modules/network/cli/cli_config.py @@ -195,43 +195,27 @@ from ansible.module_utils.connection import Connection from ansible.module_utils._text import to_text -def validate_args(module, capabilities): +def validate_args(module, device_operations): """validate param if it is supported on the platform """ - if (module.params['replace'] and - not capabilities['device_operations']['supports_replace']): - module.fail_json(msg='replace is not supported on this platform') + feature_list = [ + 'replace', 'rollback', 'commit_comment', 'defaults', 'multiline_delimiter', + 'diff_replace', 'diff_match', 'diff_ignore_lines', + ] - if (module.params['rollback'] is not None and - not capabilities['device_operations']['supports_rollback']): - module.fail_json(msg='rollback is not supported on this platform') - - if (module.params['commit_comment'] and - not capabilities['device_operations']['supports_commit_comment']): - module.fail_json(msg='commit_comment is not supported on this platform') - - if (module.params['defaults'] and - not capabilities['device_operations']['supports_defaults']): - module.fail_json(msg='defaults is not supported on this platform') - - if (module.params['multiline_delimiter'] and - not capabilities['device_operations']['supports_multiline_delimiter']): - module.fail_json(msg='multiline_delimiter is not supported on this platform') - - if (module.params['diff_replace'] and - not capabilities['device_operations']['supports_diff_replace']): - module.fail_json(msg='diff_replace is not supported on this platform') - - if (module.params['diff_match'] and - not capabilities['device_operations']['supports_diff_match']): - module.fail_json(msg='diff_match is not supported on this platform') - - if (module.params['diff_ignore_lines'] and - not capabilities['device_operations']['supports_diff_ignore_lines']): - module.fail_json(msg='diff_ignore_lines is not supported on this platform') + for feature in feature_list: + if module.params[feature]: + supports_feature = device_operations.get('supports_%s' % feature) + if supports_feature is None: + module.fail_json( + "This platform does not specify whether %s is supported or not. " + "Please report an issue against this platform's cliconf plugin." % feature + ) + elif not supports_feature: + module.fail_json(msg='Option %s is not supported on this platform' % feature) -def run(module, capabilities, connection, candidate, running, rollback_id): +def run(module, device_operations, connection, candidate, running, rollback_id): result = {} resp = {} config_diff = [] @@ -256,7 +240,7 @@ def run(module, capabilities, connection, candidate, running, rollback_id): if 'diff' in resp: result['changed'] = True - elif capabilities['device_operations']['supports_onbox_diff']: + elif device_operations.get('supports_onbox_diff'): if diff_replace: module.warn('diff_replace is ignored as the device supports onbox diff') if diff_match: @@ -274,7 +258,7 @@ def run(module, capabilities, connection, candidate, running, rollback_id): if 'diff' in resp: result['changed'] = True - elif capabilities['device_operations']['supports_generate_diff']: + elif device_operations.get('supports_generate_diff'): kwargs = {'candidate': candidate, 'running': running} if diff_match: kwargs.update({'diff_match': diff_match}) @@ -361,7 +345,10 @@ def main(): capabilities = module.from_json(connection.get_capabilities()) if capabilities: - validate_args(module, capabilities) + device_operations = capabilities.get('device_operations', dict()) + validate_args(module, device_operations) + else: + device_operations = dict() if module.params['defaults']: if 'get_default_flag' in capabilities.get('rpc'): @@ -381,7 +368,7 @@ def main(): if candidate or rollback_id: try: - result.update(run(module, capabilities, connection, candidate, running, rollback_id)) + result.update(run(module, device_operations, connection, candidate, running, rollback_id)) except Exception as exc: module.fail_json(msg=to_text(exc)) diff --git a/lib/ansible/plugins/cliconf/__init__.py b/lib/ansible/plugins/cliconf/__init__.py index cd3192f809..97f1feda93 100644 --- a/lib/ansible/plugins/cliconf/__init__.py +++ b/lib/ansible/plugins/cliconf/__init__.py @@ -278,6 +278,22 @@ class CliconfBase(AnsiblePlugin): } :return: capability as json string """ + result = {} + result['rpc'] = self.get_base_rpc() + result['device_info'] = self.get_device_info() + result['network_api'] = 'cliconf' + return result + + @abstractmethod + def get_device_info(self): + """Returns basic information about the network device. + + This method will provide basic information about the device such as OS version and model + name. This data is expected to be used to fill the 'device_info' key in get_capabilities() + above. + + :return: dictionary of device information + """ pass def commit(self, comment=None): diff --git a/lib/ansible/plugins/cliconf/aireos.py b/lib/ansible/plugins/cliconf/aireos.py index 36d9762e28..bad7f50339 100644 --- a/lib/ansible/plugins/cliconf/aireos.py +++ b/lib/ansible/plugins/cliconf/aireos.py @@ -55,7 +55,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': @@ -73,8 +73,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/aruba.py b/lib/ansible/plugins/cliconf/aruba.py index af7e902494..c8c3045ac7 100644 --- a/lib/ansible/plugins/cliconf/aruba.py +++ b/lib/ansible/plugins/cliconf/aruba.py @@ -56,7 +56,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': @@ -74,8 +74,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/asa.py b/lib/ansible/plugins/cliconf/asa.py index 2c8aea679d..d0d23cad43 100644 --- a/lib/ansible/plugins/cliconf/asa.py +++ b/lib/ansible/plugins/cliconf/asa.py @@ -53,7 +53,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': @@ -71,8 +71,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/ce.py b/lib/ansible/plugins/cliconf/ce.py index 3397766a36..6790860c8d 100644 --- a/lib/ansible/plugins/cliconf/ce.py +++ b/lib/ansible/plugins/cliconf/ce.py @@ -86,8 +86,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/cnos.py b/lib/ansible/plugins/cliconf/cnos.py index ca3a12db7f..8b02a95032 100644 --- a/lib/ansible/plugins/cliconf/cnos.py +++ b/lib/ansible/plugins/cliconf/cnos.py @@ -65,7 +65,7 @@ class Cliconf(CliconfBase): return "NA" @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): msg = "fetching configuration from %s is not supported" return self.invalid_params(msg % source) @@ -84,8 +84,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/dellos10.py b/lib/ansible/plugins/cliconf/dellos10.py index 8cc0c1b9f4..2ed9982bbe 100644 --- a/lib/ansible/plugins/cliconf/dellos10.py +++ b/lib/ansible/plugins/cliconf/dellos10.py @@ -57,7 +57,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': @@ -75,8 +75,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/dellos6.py b/lib/ansible/plugins/cliconf/dellos6.py index 5a192dc08e..746f253056 100644 --- a/lib/ansible/plugins/cliconf/dellos6.py +++ b/lib/ansible/plugins/cliconf/dellos6.py @@ -57,7 +57,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) # if source == 'running': @@ -75,8 +75,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/dellos9.py b/lib/ansible/plugins/cliconf/dellos9.py index 2d4adede74..2ea9d1fdf9 100644 --- a/lib/ansible/plugins/cliconf/dellos9.py +++ b/lib/ansible/plugins/cliconf/dellos9.py @@ -57,7 +57,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) # if source == 'running': @@ -75,8 +75,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/edgeos.py b/lib/ansible/plugins/cliconf/edgeos.py index 1d187266b2..970de0e33e 100644 --- a/lib/ansible/plugins/cliconf/edgeos.py +++ b/lib/ansible/plugins/cliconf/edgeos.py @@ -38,7 +38,7 @@ class Cliconf(CliconfBase): return device_info - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): return self.send_command('show configuration commands') def edit_config(self, candidate=None, commit=True, replace=False, comment=None): @@ -59,8 +59,6 @@ class Cliconf(CliconfBase): self.send_command('discard') def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() + ['commit', 'discard_changes'] - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['commit', 'discard_changes'] return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/edgeswitch.py b/lib/ansible/plugins/cliconf/edgeswitch.py index ddc7b2a259..44903ccbf6 100644 --- a/lib/ansible/plugins/cliconf/edgeswitch.py +++ b/lib/ansible/plugins/cliconf/edgeswitch.py @@ -103,10 +103,8 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = dict() - result['rpc'] = self.get_base_rpc() + ['run_commands'] - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['run_commands'] return json.dumps(result) def run_commands(self, commands=None, check_rc=True): diff --git a/lib/ansible/plugins/cliconf/enos.py b/lib/ansible/plugins/cliconf/enos.py index 64eea8092c..3c9267f3ef 100644 --- a/lib/ansible/plugins/cliconf/enos.py +++ b/lib/ansible/plugins/cliconf/enos.py @@ -52,7 +52,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): msg = "fetching configuration from %s is not supported" return self.invalid_params(msg % source) @@ -71,8 +71,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/eos.py b/lib/ansible/plugins/cliconf/eos.py index bce267d2f7..d5b1824086 100644 --- a/lib/ansible/plugins/cliconf/eos.py +++ b/lib/ansible/plugins/cliconf/eos.py @@ -272,13 +272,10 @@ class Cliconf(CliconfBase): } def get_capabilities(self): - result = {} - rpc_list = ['commit', 'discard_changes', 'get_diff', 'run_commands', 'supports_sessions'] - result['rpc'] = self.get_base_rpc() + rpc_list - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['commit', 'discard_changes', 'get_diff', 'run_commands', 'supports_sessions'] result['device_operations'] = self.get_device_operations() result.update(self.get_option_values()) - result['network_api'] = 'cliconf' return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/exos.py b/lib/ansible/plugins/cliconf/exos.py index 1faed72aa6..e87189f92e 100644 --- a/lib/ansible/plugins/cliconf/exos.py +++ b/lib/ansible/plugins/cliconf/exos.py @@ -114,10 +114,7 @@ class Cliconf(CliconfBase): } def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() result['device_operations'] = self.get_device_operations() result.update(self.get_option_values()) return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/ios.py b/lib/ansible/plugins/cliconf/ios.py index cca4f71902..d0855a1a22 100644 --- a/lib/ansible/plugins/cliconf/ios.py +++ b/lib/ansible/plugins/cliconf/ios.py @@ -230,10 +230,8 @@ class Cliconf(CliconfBase): } def get_capabilities(self): - result = dict() - result['rpc'] = self.get_base_rpc() + ['edit_banner', 'get_diff', 'run_commands', 'get_defaults_flag'] - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['edit_banner', 'get_diff', 'run_commands', 'get_defaults_flag'] result['device_operations'] = self.get_device_operations() result.update(self.get_option_values()) return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/iosxr.py b/lib/ansible/plugins/cliconf/iosxr.py index 8fc63008d0..b569f6ed3e 100644 --- a/lib/ansible/plugins/cliconf/iosxr.py +++ b/lib/ansible/plugins/cliconf/iosxr.py @@ -234,10 +234,8 @@ class Cliconf(CliconfBase): } def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() + ['commit', 'discard_changes', 'get_diff', 'configure', 'exit'] - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['commit', 'discard_changes', 'get_diff', 'configure', 'exit'] result['device_operations'] = self.get_device_operations() result.update(self.get_option_values()) return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/ironware.py b/lib/ansible/plugins/cliconf/ironware.py index d5546880b7..ebf24601f8 100644 --- a/lib/ansible/plugins/cliconf/ironware.py +++ b/lib/ansible/plugins/cliconf/ironware.py @@ -74,8 +74,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/junos.py b/lib/ansible/plugins/cliconf/junos.py index dadbaa600c..548b1b37c3 100644 --- a/lib/ansible/plugins/cliconf/junos.py +++ b/lib/ansible/plugins/cliconf/junos.py @@ -229,10 +229,8 @@ class Cliconf(CliconfBase): } def get_capabilities(self): - result = dict() - result['rpc'] = self.get_base_rpc() + ['commit', 'discard_changes', 'run_commands', 'compare_configuration', 'validate', 'get_diff'] - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['commit', 'discard_changes', 'run_commands', 'compare_configuration', 'validate', 'get_diff'] result['device_operations'] = self.get_device_operations() result.update(self.get_option_values()) return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/nos.py b/lib/ansible/plugins/cliconf/nos.py index f9d812c46c..f5e07ae7cd 100644 --- a/lib/ansible/plugins/cliconf/nos.py +++ b/lib/ansible/plugins/cliconf/nos.py @@ -99,8 +99,5 @@ class Cliconf(CliconfBase): return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/nxos.py b/lib/ansible/plugins/cliconf/nxos.py index e3f75815aa..b3b2480000 100644 --- a/lib/ansible/plugins/cliconf/nxos.py +++ b/lib/ansible/plugins/cliconf/nxos.py @@ -244,12 +244,10 @@ class Cliconf(CliconfBase): } def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() + ['get_diff', 'run_commands'] - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['get_diff', 'run_commands'] result['device_operations'] = self.get_device_operations() result.update(self.get_option_values()) - result['network_api'] = 'cliconf' return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/onyx.py b/lib/ansible/plugins/cliconf/onyx.py index 94f0d1ab77..4d66bdaad7 100644 --- a/lib/ansible/plugins/cliconf/onyx.py +++ b/lib/ansible/plugins/cliconf/onyx.py @@ -49,7 +49,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', format='text'): + def get_config(self, source='running', format='text', flags=None): if source not in ('running',): return self.invalid_params("fetching configuration from %s is not supported" % source) cmd = 'show running-config' @@ -64,8 +64,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/routeros.py b/lib/ansible/plugins/cliconf/routeros.py index 3efd99d366..2c5a922766 100644 --- a/lib/ansible/plugins/cliconf/routeros.py +++ b/lib/ansible/plugins/cliconf/routeros.py @@ -65,8 +65,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/slxos.py b/lib/ansible/plugins/cliconf/slxos.py index 550a245540..4cdbaedc7e 100644 --- a/lib/ansible/plugins/cliconf/slxos.py +++ b/lib/ansible/plugins/cliconf/slxos.py @@ -91,8 +91,5 @@ class Cliconf(CliconfBase): return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/voss.py b/lib/ansible/plugins/cliconf/voss.py index 7f37d0707d..f105266819 100644 --- a/lib/ansible/plugins/cliconf/voss.py +++ b/lib/ansible/plugins/cliconf/voss.py @@ -192,10 +192,8 @@ class Cliconf(CliconfBase): } def get_capabilities(self): - result = dict() - result['rpc'] = self.get_base_rpc() + ['get_diff', 'run_commands', 'get_defaults_flag'] - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['get_diff', 'run_commands', 'get_defaults_flag'] result['device_operations'] = self.get_device_operations() result.update(self.get_option_values()) return json.dumps(result) diff --git a/lib/ansible/plugins/cliconf/vyos.py b/lib/ansible/plugins/cliconf/vyos.py index 2a08cf8a2c..a5b9f42f9c 100644 --- a/lib/ansible/plugins/cliconf/vyos.py +++ b/lib/ansible/plugins/cliconf/vyos.py @@ -241,10 +241,8 @@ class Cliconf(CliconfBase): } def get_capabilities(self): - result = {} - result['rpc'] = self.get_base_rpc() + ['commit', 'discard_changes', 'get_diff', 'run_commands'] - result['network_api'] = 'cliconf' - result['device_info'] = self.get_device_info() + result = super(Cliconf, self).get_capabilities() + result['rpc'] += ['commit', 'discard_changes', 'get_diff', 'run_commands'] result['device_operations'] = self.get_device_operations() result.update(self.get_option_values()) return json.dumps(result)