diff --git a/CHANGELOG.md b/CHANGELOG.md index 09828160..7553408d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [20.4] (unreleased) +### Added +- Add solution method to solution of vt object. [#166](https://github.com/greenbone/ospd/pull/166) + ## [2.0.1] (unreleased) ### Added diff --git a/doc/OSP.xml b/doc/OSP.xml index 9d66e9d4..c08de7b0 100644 --- a/doc/OSP.xml +++ b/doc/OSP.xml @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. Open Scanner Protocol OSP The Open Scanner Protocol - 1.2 + 20.04 @@ -953,6 +953,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. Solution type, for example "VendorFix" string + + method + Solution method, for example "DebianAPTUpgrade" + string + @@ -1302,6 +1307,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. An ovaldef file's content that is base64 encoded + + GET_VTS + Returned object extended with solution method + + The element SOLUTION of the returned VT object has a new optional attribute METHOD + that describes the solution method in case the VT offers such a detail. + + 20.04 + + GET_VTS command added diff --git a/ospd/ospd.py b/ospd/ospd.py index 5ab5bf0b..95c6dfc7 100644 --- a/ospd/ospd.py +++ b/ospd/ospd.py @@ -1,4 +1,4 @@ -# Copyright (C) 2014-2018 Greenbone Networks GmbH +# Copyright (C) 2014-2019 Greenbone Networks GmbH # # SPDX-License-Identifier: GPL-2.0-or-later # @@ -255,6 +255,7 @@ def add_vt( insight=None, solution=None, solution_t=None, + solution_m=None, detection=None, qod_t=None, qod_v=None, @@ -301,6 +302,8 @@ def add_vt( vt["solution"] = solution if solution_t is not None: vt["solution_type"] = solution_t + if solution_m is not None: + vt["solution_method"] = solution_m if detection is not None: vt["detection"] = detection @@ -1420,7 +1423,7 @@ def get_insight_vt_as_xml_str( @staticmethod def get_solution_vt_as_xml_str( - vt_id, solution, solution_type=None + vt_id, solution, solution_type=None, solution_method=None ): # pylint: disable=unused-argument """ Create a string representation of the XML object from the solution data object. @@ -1538,7 +1541,8 @@ def get_vt_xml(self, vt_id): if vt.get('solution'): solution_xml_str = self.get_solution_vt_as_xml_str( - vt_id, vt.get('solution'), vt.get('solution_type') + vt_id, vt.get('solution'), vt.get('solution_type'), + vt.get('solution_method') ) vt_xml.append(secET.fromstring(solution_xml_str)) diff --git a/tests/test_scan_and_result.py b/tests/test_scan_and_result.py index 59647942..1e078de4 100644 --- a/tests/test_scan_and_result.py +++ b/tests/test_scan_and_result.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2018 Greenbone Networks GmbH +# Copyright (C) 2015-2019 Greenbone Networks GmbH # # SPDX-License-Identifier: GPL-2.0-or-later # @@ -136,7 +136,8 @@ def get_insight_vt_as_xml_str(vt_id, insight): return response @staticmethod - def get_solution_vt_as_xml_str(vt_id, solution, solution_type=None): + def get_solution_vt_as_xml_str(vt_id, solution, solution_type=None, + solution_method=None): response = 'Some solution' return response @@ -580,6 +581,7 @@ def test_get_vts_vts_with_solution(self): custom="b", solution="c", solution_t="d", + solution_m="e", ) response = secET.fromstring(