diff --git a/CHANGELOG.md b/CHANGELOG.md index 260e36198..b4c76a66c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +* Added protocol version "next" and GMP 21.04 doc [#384](https://github.com/greenbone/python-gvm/pull/384) + ### Changed ### Deprecated ### Removed diff --git a/docs/api/gmpv214.rst b/docs/api/gmpv214.rst new file mode 100644 index 000000000..1334803a7 --- /dev/null +++ b/docs/api/gmpv214.rst @@ -0,0 +1,92 @@ +.. _gmpv214: + +GMP v21.4 +^^^^^^^^^ + +.. automodule:: gvm.protocols.gmpv214 + +Enums +----- + +.. autoclass:: AlertCondition + :members: + :undoc-members: + +.. autoclass:: AlertEvent + :members: + :undoc-members: + +.. autoclass:: AlertMethod + :members: + :undoc-members: + +.. autoclass:: AliveTest + :members: + :undoc-members: + +.. autoclass:: AssetType + :members: + :undoc-members: + +.. autoclass:: CredentialFormat + :members: + :undoc-members: + +.. autoclass:: CredentialType + :members: + :undoc-members: + +.. autoclass:: EntityType + :members: + :undoc-members: + +.. autoclass:: FeedType + :members: + :undoc-members: + +.. autoclass:: FilterType + :members: + :undoc-members: + +.. autoclass:: HostsOrdering + :members: + :undoc-members: + +.. autoclass:: InfoType + :members: + :undoc-members: + +.. autoclass:: PermissionSubjectType + :members: + :undoc-members: + +.. autoclass:: ScannerType + :members: + :undoc-members: + +.. autoclass:: PortRangeType + :members: + :undoc-members: + +.. autoclass:: SeverityLevel + :members: + :undoc-members: + +.. autoclass:: SnmpAuthAlgorithm + :members: + :undoc-members: + +.. autoclass:: SnmpPrivacyAlgorithm + :members: + :undoc-members: + +.. autoclass:: TicketStatus + :members: + :undoc-members: + +Protocol +-------- + +.. autoclass:: Gmp + :members: + :inherited-members: diff --git a/docs/api/protocols.rst b/docs/api/protocols.rst index 1dbbc55c7..37a5564c2 100644 --- a/docs/api/protocols.rst +++ b/docs/api/protocols.rst @@ -12,6 +12,7 @@ Protocols gmpv8 gmpv9 gmpv208 + gmpv214 ospv1 Dynamic @@ -20,7 +21,13 @@ Dynamic To dynamically use the supported GMP version of the manager daemon see :mod:`gvm.protocols.gmp` for details. -Latest -^^^^^^ +"latest" protocols +^^^^^^^^^^^^^^^^^^ .. automodule:: gvm.protocols.latest + + +"next" protocols +^^^^^^^^^^^^^^^^ + +.. automodule:: gvm.protocols.next diff --git a/docs/conf.py b/docs/conf.py index 910cef946..47bea4b82 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # @@ -24,7 +24,7 @@ # -- Project information ----------------------------------------------------- project = 'python-gvm' -copyright = '2018 - 2019, Greenbone Networks GmbH' +copyright = '2018 - 2021, Greenbone Networks GmbH' author = 'Greenbone Networks GmbH' # The short X.Y version diff --git a/gvm/protocols/__init__.py b/gvm/protocols/__init__.py index 58f454c1b..d19eaf50c 100644 --- a/gvm/protocols/__init__.py +++ b/gvm/protocols/__init__.py @@ -19,7 +19,7 @@ Package for supported Greenbone Protocol versions. Currently `GMP version 7`_, `GMP version 8`_, `GMP version 9`_ , -`GMP version 20.08`_ and `OSP version 1`_ are supported. +`GMP version 20.08`_, `GMP version 21.04`_ and `OSP version 1`_ are supported. .. _GMP version 7: https://docs.greenbone.net/API/GMP/gmp-7.0.html @@ -29,6 +29,8 @@ https://docs.greenbone.net/API/GMP/gmp-9.0.html .. _GMP version 20.08: https://docs.greenbone.net/API/GMP/gmp-20.08.html +.. _GMP version 21.04: + https://docs.greenbone.net/API/GMP/gmp-21.04.html .. _OSP version 1: https://docs.greenbone.net/API/OSP/osp-1.2.html """ diff --git a/gvm/protocols/latest.py b/gvm/protocols/latest.py index 4b940abc6..f926fe131 100644 --- a/gvm/protocols/latest.py +++ b/gvm/protocols/latest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2018 - 2019 Greenbone Networks GmbH +# Copyright (C) 2018 - 2021 Greenbone Networks GmbH # # SPDX-License-Identifier: GPL-3.0-or-later # @@ -15,9 +15,10 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""Latest supported protocols. +"""Latest supported stable protocols. -This module exposes the latest supported protocols of gvm. +This module exposes the latest supported protocols for the newest stable +release branch of GVM. The provided Gmp class implements the latest `Greenbone Management Protocol`_. @@ -27,7 +28,7 @@ :py:mod:`gvm.protocols`. Exports: - - :py:class:`gvm.protocols.gmpv20.08Gmp` + - :py:class:`gvm.protocols.gmpv208.Gmp` - :py:class:`gvm.protocols.ospv1.Osp` .. _Greenbone Management Protocol: diff --git a/gvm/protocols/next.py b/gvm/protocols/next.py new file mode 100644 index 000000000..5b4e6039c --- /dev/null +++ b/gvm/protocols/next.py @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2018 - 2021 Greenbone Networks GmbH +# +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +"""Latest supported protocols, including unstable ones. + +This module exposes the latest supported protocols of GVM including versions +not yet released as stable. + +The provided Gmp class implements the latest `Greenbone Management +Protocol`_. +The provided Osp class implements the latest Open Scanner Protocol. + +For details about the possible supported protocol versions please take a look at +:py:mod:`gvm.protocols`. + +Exports: + - :py:class:`gvm.protocols.gmpv214.Gmp` + - :py:class:`gvm.protocols.ospv1.Osp` + +.. _Greenbone Management Protocol: + https://docs.greenbone.net/API/GMP/gmp.html +""" + +from .gmpv214 import ( + Gmp, + AggregateStatistic, + AlertCondition, + AlertEvent, + AlertMethod, + AliveTest, + AssetType, + CredentialFormat, + CredentialType, + EntityType, + FeedType, + FilterType, + HostsOrdering, + InfoType, + PermissionSubjectType, + PortRangeType, + ScannerType, + SeverityLevel, + SnmpAuthAlgorithm, + SnmpPrivacyAlgorithm, + SortOrder, + TicketStatus, + TimeUnit, + UserAuthType, + get_aggregate_statistic_from_string, + get_alert_condition_from_string, + get_alert_event_from_string, + get_alert_method_from_string, + get_alive_test_from_string, + get_asset_type_from_string, + get_credential_format_from_string, + get_credential_type_from_string, + get_entity_type_from_string, + get_feed_type_from_string, + get_filter_type_from_string, + get_hosts_ordering_from_string, + get_info_type_from_string, + get_permission_subject_type_from_string, + get_port_range_type_from_string, + get_scanner_type_from_string, + get_severity_level_from_string, + get_snmp_auth_algorithm_from_string, + get_snmp_privacy_algorithm_from_string, + get_sort_order_from_string, + get_ticket_status_from_string, + get_time_unit_from_string, + get_user_auth_type_from_string, +) +from .ospv1 import Osp + +__all__ = [ + "Gmp", + "Osp", + "AggregateStatistic", + "AlertCondition", + "AlertEvent", + "AlertMethod", + "AliveTest", + "AssetType", + "CredentialType", + "CredentialFormat", + "EntityType", + "FeedType", + "FilterType", + "HostsOrdering", + "InfoType", + "PermissionSubjectType", + "PortRangeType", + "ScannerType", + "SeverityLevel", + "SnmpAuthAlgorithm", + "SnmpPrivacyAlgorithm", + "SortOrder", + "TicketStatus", + "TimeUnit", + "UserAuthType", + "get_aggregate_statistic_from_string", + "get_alert_condition_from_string", + "get_alert_event_from_string", + "get_alert_method_from_string", + "get_alive_test_from_string", + "get_asset_type_from_string", + "get_credential_format_from_string", + "get_credential_type_from_string", + "get_entity_type_from_string", + "get_feed_type_from_string", + "get_filter_type_from_string", + "get_hosts_ordering_from_string", + "get_info_type_from_string", + "get_permission_subject_type_from_string", + "get_port_range_type_from_string", + "get_scanner_type_from_string", + "get_severity_level_from_string", + "get_snmp_auth_algorithm_from_string", + "get_snmp_privacy_algorithm_from_string", + "get_sort_order_from_string", + "get_ticket_status_from_string", + "get_time_unit_from_string", + "get_user_auth_type_from_string", +] diff --git a/tests/protocols/test_next.py b/tests/protocols/test_next.py new file mode 100644 index 000000000..82be11a2c --- /dev/null +++ b/tests/protocols/test_next.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2018 Greenbone Networks GmbH +# +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import unittest + +from gvm.protocols.next import Gmp, Osp + + +class LatestProtocolsTestCase(unittest.TestCase): + def test_gmp_version(self): + self.assertEqual(Gmp.get_protocol_version(), (21, 4)) + + def test_osp_version(self): + self.assertEqual(Osp.get_protocol_version(), (1, 2)) + + +if __name__ == '__main__': + unittest.main()