diff options
author | Vratko Polak <vrpolak@cisco.com> | 2018-04-13 19:45:33 +0200 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2018-04-25 08:47:31 +0000 |
commit | 4c6fe5602edcbd9857a846e5b13a21d5c671a2c8 (patch) | |
tree | b360a3e65094f9fe542451a747132ff24663b115 /resources/libraries/python/honeycomb | |
parent | 59e06f5e3143bf093bdb6b53c0186b050668e3d4 (diff) |
Fix warnings reported by gen_doc.sh
+ Docstring warnings fixed.
+ Multiline param descriptions indented by 4 spaces.
- Except the PacketVerifier.py one
- I have tried several quote-like blocks, nothing works.
- Rst warnings not fixed.
- How can I fix them? They refer to temporarily created files.
+ Other improvements:
+ Python lines no longer than 80 characters.
+ :return: -> :returns:
+ Notes before params.
+ :raises
+ closing colon after exception class.
+ Description is a sentence.
+ Present tense in conditional sentences.
+ Bumped copyright year in edited files.
Change-Id: I462c194eeecb666dc146e26858486a07c990be9b
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/honeycomb')
-rw-r--r-- | resources/libraries/python/honeycomb/BGP.py | 11 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/DHCP.py | 4 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HcAPIKwACL.py | 8 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py | 66 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HcAPIKwInterfaces.py | 71 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HcAPIKwNSH.py | 20 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HcPersistence.py | 4 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HoneycombSetup.py | 46 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HoneycombUtil.py | 104 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/Lisp.py | 18 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/NAT.py | 6 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/Netconf.py | 14 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/Notifications.py | 4 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/Performance.py | 4 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/ProxyARP.py | 8 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/Routing.py | 4 |
16 files changed, 201 insertions, 191 deletions
diff --git a/resources/libraries/python/honeycomb/BGP.py b/resources/libraries/python/honeycomb/BGP.py index 75dce762ff..fa51b8727b 100644 --- a/resources/libraries/python/honeycomb/BGP.py +++ b/resources/libraries/python/honeycomb/BGP.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -44,7 +44,7 @@ class BGPKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. + 200 = OK or 201 = ACCEPTED. """ if data is None: @@ -72,7 +72,7 @@ class BGPKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. + 200 = OK or 201 = ACCEPTED. """ if data is None: @@ -115,7 +115,7 @@ class BGPKeywords(object): :param datastore: Get data from config or operational datastore. :type node: dict :type address: str - :type datastore; str + :type datastore: str :returns: BGP peer configuration data. :rtype: dict :raises HoneycombError: If the status code in response is not 200 = OK. @@ -382,7 +382,8 @@ class BGPKeywords(object): :param ref: Reference data to compare against. :type data: dict :type ref: dict - :raises HoneycombError: If the tables do not match.""" + :raises HoneycombError: If the tables do not match. + """ # Remove runtime attributes from data for item in data: diff --git a/resources/libraries/python/honeycomb/DHCP.py b/resources/libraries/python/honeycomb/DHCP.py index 3c03b1405f..13cc4a77cc 100644 --- a/resources/libraries/python/honeycomb/DHCP.py +++ b/resources/libraries/python/honeycomb/DHCP.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,7 +37,7 @@ class DHCPRelayKeywords(object): :type node: dict :type path: str :type data: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response is not 200 = OK or 201 = ACCEPTED. diff --git a/resources/libraries/python/honeycomb/HcAPIKwACL.py b/resources/libraries/python/honeycomb/HcAPIKwACL.py index 556c39644f..49fc351b01 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwACL.py +++ b/resources/libraries/python/honeycomb/HcAPIKwACL.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -50,7 +50,7 @@ class ACLKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not - 200 = OK. + 200 = OK. """ if data: @@ -266,7 +266,6 @@ class ACLKeywords(object): :type list_name: str :type data: dict :type macip: bool - :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the operation fails. @@ -296,14 +295,13 @@ class ACLKeywords(object): :param interface: Name of an interface on the node. :param acl_name: Name of an ACL chain configured through ACL-plugin. :param direction: Classify incoming or outgiong packets. - Valid options are: ingress, egress + Valid options are: ingress, egress :param macip: Use simple MAC+IP classifier. Optional. :type node: dict :type interface: str or int :type acl_name: str :type direction: str :type macip: bool - :returns: Content of response. :rtype: bytearray :raises ValueError: If the direction argument is incorrect. diff --git a/resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py b/resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py index 3c629c96e4..576124794c 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py +++ b/resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -52,10 +52,10 @@ class BridgeDomainKeywords(object): :type bd_name: str :type data: dict :type data_representation: DataRepresentation - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response on PUT is not - 200 = OK. + 200 = OK. """ status_code, resp = HcUtil.\ @@ -78,12 +78,12 @@ class BridgeDomainKeywords(object): :param bd_name: The name of bridge domain. :param path: Path to data we want to change, create or remove. :param new_value: The new value to be set. If None, the item will be - removed. + removed. :type node: dict :type bd_name: str :type path: tuple :type new_value: str, dict or list - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If it is not possible to get or set the data. """ @@ -109,10 +109,10 @@ class BridgeDomainKeywords(object): :param bd_name: Bridge domain name. :param kwargs: Parameters and their values. The accepted parameters are - defined in BridgeDomainKeywords.PARAMS. + defined in BridgeDomainKeywords.PARAMS. :type bd_name: str :type kwargs: dict - :return: Bridge domain data structure. + :returns: Bridge domain data structure. :rtype: dict """ @@ -132,7 +132,7 @@ class BridgeDomainKeywords(object): :param node: Honeycomb node. :type node: dict - :return: Configuration data about all bridge domains from Honeycomb. + :returns: Configuration data about all bridge domains from Honeycomb. :rtype: list :raises HoneycombError: If it is not possible to get configuration data. """ @@ -157,8 +157,8 @@ class BridgeDomainKeywords(object): :param bd_name: The name of bridge domain. :type node: dict :type bd_name: str - :return: Configuration data about the given bridge domain from - Honeycomb. + :returns: Configuration data about the given bridge domain from + Honeycomb. :rtype: dict """ @@ -174,7 +174,7 @@ class BridgeDomainKeywords(object): :param node: Honeycomb node. :type node: dict - :return: Operational data about all bridge domains from Honeycomb. + :returns: Operational data about all bridge domains from Honeycomb. :rtype: list :raises HoneycombError: If it is not possible to get operational data. """ @@ -199,7 +199,7 @@ class BridgeDomainKeywords(object): :param bd_name: The name of bridge domain. :type node: dict :type bd_name: str - :return: Operational data about the given bridge domain from Honeycomb. + :returns: Operational data about the given bridge domain from Honeycomb. :rtype: dict """ @@ -218,11 +218,11 @@ class BridgeDomainKeywords(object): :param node: Honeycomb node. :param bd_name: Bridge domain name. :param kwargs: Parameters and their values. The accepted parameters are - defined in BridgeDomainKeywords.PARAMS + defined in BridgeDomainKeywords.PARAMS :type node: dict :type bd_name: str :type kwargs: dict - :return: Bridge domain data structure. + :returns: Bridge domain data structure. :rtype: dict """ @@ -237,11 +237,11 @@ class BridgeDomainKeywords(object): :param node: Honeycomb node. :param bd_name: Bridge domain name. :param kwargs: Parameters and their values. The accepted parameters are - defined in BridgeDomainKeywords.PARAMS + defined in BridgeDomainKeywords.PARAMS :type node: dict :type bd_name: str :type kwargs: dict - :return: Bridge domain data structure. + :returns: Bridge domain data structure. :rtype: dict """ @@ -257,10 +257,10 @@ class BridgeDomainKeywords(object): :param node: Honeycomb node. :type node: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If it is not possible to remove all bridge - domains. + domains. """ data = {"bridge-domains": {"bridge-domain": []}} @@ -281,10 +281,10 @@ class BridgeDomainKeywords(object): :param bd_name: The name of bridge domain to be removed. :type node: dict :type bd_name: str - :return: Content of response. + :returns: Content of response. :rtype: bytearray - :raises HoneycombError:If it is not possible to remove the bridge - domain. + :raises HoneycombError: If it is not possible to remove the bridge + domain. """ path = ("bridge-domains", ("bridge-domain", "name", bd_name)) @@ -312,14 +312,14 @@ class BridgeDomainKeywords(object): :param node: Honeycomb node. :param bd_name: Bridge domain name. :param param: Parameter to set, change or remove. The accepted - parameters are defined in BridgeDomainKeywords.PARAMS + parameters are defined in BridgeDomainKeywords.PARAMS :param value: The new value to be set, change or remove. If None, the - item will be removed. + item will be removed. :type node: dict :type bd_name: str :type param: str :type value: str - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -340,7 +340,7 @@ class BridgeDomainKeywords(object): :type node: dict :type bd_name: str :type l2_fib_entry: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -368,7 +368,7 @@ class BridgeDomainKeywords(object): :type mac: str :type param: str :type value: str or int - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -392,10 +392,10 @@ class BridgeDomainKeywords(object): :type node: dict :type bd_name: str :type mac: str - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If it is not possible to remove the specified - entry. + entry. """ path = ("bridge-domains", @@ -429,7 +429,7 @@ class BridgeDomainKeywords(object): :param bd_name: Bridge domain's name. :type node: dict :type bd_name: str - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -448,8 +448,8 @@ class BridgeDomainKeywords(object): :param bd_name: Bridge domain's name. :type node: dict :type bd_name: str - :return: Bridge domain's L2 FIB table or empty list if the table does - not exist or it is empty. + :returns: Bridge domain's L2 FIB table or empty list if the table does + not exist or it is empty. :rtype: list """ @@ -470,8 +470,8 @@ class BridgeDomainKeywords(object): :type node: dict :type bd_name: str :type mac: str - :return: The requested entry from bridge domain's L2 FIB table or empty - dictionary if it does not exist in the L2 FIB table. + :returns: The requested entry from bridge domain's L2 FIB table or empty + dictionary if it does not exist in the L2 FIB table. :rtype: dict """ diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index 09c9ae9a3b..a7aebbba25 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -86,7 +86,7 @@ class InterfaceKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response on PUT is not - 200 = OK. + 200 = OK. """ status_code, resp = HcUtil.\ @@ -228,7 +228,7 @@ class InterfaceKeywords(object): :param interface: The name of interface. :param path: Path to data we want to change / create / remove. :param new_value: The new value to be set. If None, the item will be - removed. + removed. :type node: dict :type interface: str :type path: tuple @@ -261,7 +261,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: Interface name, key, link name or sw_if_index. :param state: The requested state, only "up" and "down" are valid - values. + values. :type node: dict :type interface: str :type state: str @@ -370,7 +370,6 @@ class InterfaceKeywords(object): :param interface: Interface name, key, link name or sw_if_index. :type node: dict :type interface: str or int - :raises HoneycombError: If the operation fails. """ @@ -402,7 +401,7 @@ class InterfaceKeywords(object): :type node: dict :type interface: str :returns: Operational data about bridge domain settings in the - interface. + interface. :rtype: dict """ @@ -423,7 +422,7 @@ class InterfaceKeywords(object): :param interface: The name of interface. :param param: Parameter to configure (set, change, remove) :param value: The value of parameter. If None, the parameter will be - removed. + removed. :type node: dict :type interface: str :type param: str @@ -448,7 +447,7 @@ class InterfaceKeywords(object): :param interface: The name of interface. :param param: Parameter to configure (set, change, remove) :param value: The value of parameter. If None, the parameter will be - removed. + removed. :type node: dict :type interface: str :type param: str @@ -617,7 +616,7 @@ class InterfaceKeywords(object): :param interface: The name of interface. :param param: Parameter to configure (set, change, remove) :param value: The value of parameter. If None, the parameter will be - removed. + removed. :type node: dict :type interface: str :type param: str @@ -763,7 +762,7 @@ class InterfaceKeywords(object): :param interface: The name of interface. :param param: Parameter to configure (set, change, remove) :param value: The value of parameter. If None, the parameter will be - removed. + removed. :type node: dict :type interface: str :type param: str @@ -788,7 +787,7 @@ class InterfaceKeywords(object): :param interface: The name of interface. :param param: Parameter to configure (set, change, remove) :param value: The value of parameter. If None, the parameter will be - removed. + removed. :type node: dict :type interface: str :type param: str @@ -816,7 +815,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: The name of interface. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VXLAN_PARAMS. + defined in InterfaceKeywords.VXLAN_PARAMS. :type node: dict :type interface: str :type kwargs: dict @@ -852,7 +851,7 @@ class InterfaceKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If it is not possible to get information about - interfaces or it is not possible to delete the interface. + interfaces or it is not possible to delete the interface. """ path = ("interfaces", ("interface", "name", interface)) @@ -887,7 +886,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: The name of interface. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VXLAN_PARAMS. + defined in InterfaceKeywords.VXLAN_PARAMS. :type node: dict :type interface: str :type kwargs: dict @@ -915,7 +914,7 @@ class InterfaceKeywords(object): :param interface: The name of interface. :param param: Parameter to configure (set, change, remove) :param value: The value of parameter. If None, the parameter will be - removed. + removed. :type node: dict :type interface: str :type param: str @@ -939,7 +938,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: The name of interface. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.TAP_PARAMS. + defined in InterfaceKeywords.TAP_PARAMS. :type node: dict :type interface: str :type kwargs: dict @@ -978,7 +977,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: The name of interface. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.TAP_PARAMS. + defined in InterfaceKeywords.TAP_PARAMS. :type node: dict :type interface: str :type kwargs: dict @@ -1012,7 +1011,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: The name of interface. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VHOST_USER_PARAMS. + defined in InterfaceKeywords.VHOST_USER_PARAMS. :type node: dict :type interface: str :type kwargs: dict @@ -1040,7 +1039,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: The name of interface. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VHOST_USER_PARAMS. + defined in InterfaceKeywords.VHOST_USER_PARAMS. :type node: dict :type interface: str :type kwargs: dict @@ -1073,10 +1072,10 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param super_interface: Super interface. :param match: Match type. The valid values are defined in - InterfaceKeywords.SUB_IF_MATCH. + InterfaceKeywords.SUB_IF_MATCH. :param tags: List of tags. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.SUB_IF_PARAMS. + defined in InterfaceKeywords.SUB_IF_PARAMS. :type node: dict :type super_interface: str :type match: str @@ -1380,13 +1379,13 @@ class InterfaceKeywords(object): :param data: Data to be checked. :param ref: Referential data used for comparison. :param _path: Used in recursive calls, stores the path taken down - the JSON tree. + the JSON tree. :type data: dict :type ref: dict :type _path: str :raises HoneycombError: If the data structures do not match in some way, - or if they are not in deserialized JSON format. + or if they are not in deserialized JSON format. """ if data == ref: @@ -1474,7 +1473,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: The name of interface to be created. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VXLAN_GPE_PARAMS. + defined in InterfaceKeywords.VXLAN_GPE_PARAMS. :type node: dict :type interface: str :type kwargs: dict @@ -1514,7 +1513,7 @@ class InterfaceKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the configuration of interface is not - successful. + successful. """ interface = interface.replace("/", "%2F") @@ -1555,7 +1554,7 @@ class InterfaceKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the configuration of interface is not - successful. + successful. """ interface = Topology.convert_interface_reference( node, interface, "name") @@ -1588,7 +1587,7 @@ class InterfaceKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the configuration of interface is not - successful. + successful. """ interface = Topology.convert_interface_reference( node, interface, "name") @@ -1614,7 +1613,7 @@ class InterfaceKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the configuration of interface is not - successful. + successful. """ interface = interface.replace("/", "%2F") @@ -1638,14 +1637,14 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param intf: The interface where PBB sub-interface will be configured. :param params: Configuration parameters of the sub-interface to be - created. + created. :type node: dict :type intf: str :type params: dict :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the configuration of sub-interface is not - successful. + successful. """ interface = intf.replace("/", "%2F") @@ -1670,7 +1669,7 @@ class InterfaceKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the removal of sub-interface is not - successful. + successful. """ interface = intf.replace("/", "%2F") @@ -1697,7 +1696,7 @@ class InterfaceKeywords(object): :returns: PBB sub-interface operational data. :rtype: dict :raises HoneycombError: If the removal of sub-interface is not - successful. + successful. """ raise NotImplementedError @@ -1714,8 +1713,8 @@ class InterfaceKeywords(object): :returns: True if the interface exists in disabled interfaces. :rtype: bool :raises HoneycombError: If the interface is not present - in retrieved list of disabled interfaces. - """ + in retrieved list of disabled interfaces. + """ data = InterfaceKeywords.get_disabled_interfaces_oper_data(node) # decrement by one = conversion from HC if-index to VPP sw_if_index interface -= 1 @@ -1780,7 +1779,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param super_interface: Name, link name or sw_if_index - of the destination interface's super-interface. + of the destination interface's super-interface. :param dst_interface_index: Index of sub-interface to mirror packets to. :param src_interfaces: List of interfaces to mirror packets from. :type node: dict @@ -1880,7 +1879,7 @@ class InterfaceKeywords(object): :param node: Honeycomb node. :param interface: Name, link name or sw_if_index of an interface, - name of a custom interface or name of a sub-interface. + name of a custom interface or name of a sub-interface. :type node: Honeycomb node. :type interface: str or int :returns: Name of interface that can be used in Honeycomb requests. diff --git a/resources/libraries/python/honeycomb/HcAPIKwNSH.py b/resources/libraries/python/honeycomb/HcAPIKwNSH.py index ce60628d83..e042fdd423 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwNSH.py +++ b/resources/libraries/python/honeycomb/HcAPIKwNSH.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,10 +43,10 @@ class NSHKeywords(object): :type node: dict :type path: str :type data: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not - OK or ACCEPTED. + OK or ACCEPTED. """ if data: @@ -74,7 +74,7 @@ class NSHKeywords(object): :type node: dict :type name: str :type data: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -93,7 +93,7 @@ class NSHKeywords(object): :type node: dict :type name: str :type data: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ path = "/nsh-maps/nsh-map/{0}".format(name) @@ -107,7 +107,7 @@ class NSHKeywords(object): :param name: Name of the NSH entry. :type node: dict :type name: str - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -121,7 +121,7 @@ class NSHKeywords(object): :param name: Name of the NSH map. :type node: dict :type name: str - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -136,11 +136,11 @@ class NSHKeywords(object): :param node: Honeycomb node. :param entry_name: Name of a specific NSH entry. Optional. :param map_name: Name of a specific NSH map. Optional. Do not use - together with entry_name. + together with entry_name. :type node: dict :type entry_name: str :type map_name: str - :return: List of classify tables. + :returns: List of classify tables. :rtype: list """ if entry_name: @@ -166,7 +166,7 @@ class NSHKeywords(object): :param node: Honeycomb node. :type node: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ diff --git a/resources/libraries/python/honeycomb/HcPersistence.py b/resources/libraries/python/honeycomb/HcPersistence.py index e1b827f9c9..ffa850fc9e 100644 --- a/resources/libraries/python/honeycomb/HcPersistence.py +++ b/resources/libraries/python/honeycomb/HcPersistence.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -70,7 +70,7 @@ class HcPersistence(object): :type find: string :type replace: string :raises HoneycombError: If persistent configuration couldn't be - modified. + modified. """ argument = "\"s/{0}/{1}/g\"".format(find, replace) diff --git a/resources/libraries/python/honeycomb/HoneycombSetup.py b/resources/libraries/python/honeycomb/HoneycombSetup.py index a8a4f0e292..8ca34033b0 100644 --- a/resources/libraries/python/honeycomb/HoneycombSetup.py +++ b/resources/libraries/python/honeycomb/HoneycombSetup.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -54,6 +54,7 @@ class HoneycombSetup(object): Honeycomb is up and running. Honeycomb must be installed in "/opt" directory, otherwise the start will fail. + :param nodes: List of nodes to start Honeycomb on. :type nodes: list :raises HoneycombError: If Honeycomb fails to start. @@ -86,6 +87,7 @@ class HoneycombSetup(object): stops the Honeycomb and does not check its shutdown state. Use the keyword "Check Honeycomb Shutdown State" to check if Honeycomb has stopped. + :param nodes: List of nodes to stop Honeycomb on. :type nodes: list :raises HoneycombError: If Honeycomb failed to stop. @@ -155,7 +157,8 @@ class HoneycombSetup(object): :type retries: int :type interval: int :raises HoneycombError: If the Honeycomb process IP cannot be found, - or if timeout or number of retries is exceeded.""" + or if timeout or number of retries is exceeded. + """ ssh = SSH() ssh.connect(node) @@ -207,8 +210,8 @@ class HoneycombSetup(object): :param node: List of DUT nodes stopping Honeycomb. :type node: dict - :return: True if all GETs fail to connect. - :rtype bool + :returns: True if all GETs fail to connect. + :rtype: bool """ cmd = "pgrep honeycomb" @@ -229,10 +232,10 @@ class HoneycombSetup(object): """Configure Honeycomb to accept restconf requests from all IP addresses. IP version is determined by node data. - :param node: Information about a DUT node. - :type node: dict - :raises HoneycombError: If the configuration could not be changed. - """ + :param node: Information about a DUT node. + :type node: dict + :raises HoneycombError: If the configuration could not be changed. + """ find = "restconf-binding-address" try: @@ -257,12 +260,12 @@ class HoneycombSetup(object): def configure_jvpp_timeout(node, timeout=10): """Configure timeout value for Java API commands Honeycomb sends to VPP. - :param node: Information about a DUT node. - :param timeout: Timeout value in seconds. - :type node: dict - :type timeout: int - :raises HoneycombError: If the configuration could not be changed. - """ + :param node: Information about a DUT node. + :param timeout: Timeout value in seconds. + :type node: dict + :type timeout: int + :raises HoneycombError: If the configuration could not be changed. + """ find = "jvpp-request-timeout" replace = '\\"jvpp-request-timeout\\": {0}'.format(timeout) @@ -367,7 +370,7 @@ class HoneycombSetup(object): :type feature: string :type disable: bool :raises HoneycombError: If the configuration could not be changed. - """ + """ disabled_features = { "NSH": ["io.fd.hc2vpp.vppnsh.impl.VppNshModule"], @@ -477,6 +480,7 @@ class HoneycombSetup(object): Karaf should be located in the provided path, and VPP and Honeycomb should already be running, otherwise the start will fail. + :param node: Node to start ODL client on. :param path: Path to ODL client on node. :type node: dict @@ -716,11 +720,11 @@ class HoneycombStartupConfig(object): def apply_config(self, node): """Generate configuration file /opt/honeycomb/honeycomb on the specified - node. + node. - :param node: Honeycomb node. - :type node: dict - """ + :param node: Honeycomb node. + :type node: dict + """ self.ssh.connect(node) _, filename, _ = self.ssh.exec_command("ls /opt/honeycomb | grep .jar") @@ -785,7 +789,7 @@ class HoneycombStartupConfig(object): :param mem_min: Minimum amount of memory (MB). :param mem_max: Maximum amount of memory (MB). Default is 4 times - minimum value. + minimum value. :type mem_min: int :type mem_max: int """ @@ -798,7 +802,7 @@ class HoneycombStartupConfig(object): :param mem_min: Minimum metaspace size (MB). :param mem_max: Maximum metaspace size (MB). Defailt is 4 times - minimum value. + minimum value. :type mem_min: int :type mem_max: int """ diff --git a/resources/libraries/python/honeycomb/HoneycombUtil.py b/resources/libraries/python/honeycomb/HoneycombUtil.py index 76bb5b3878..74e0294055 100644 --- a/resources/libraries/python/honeycomb/HoneycombUtil.py +++ b/resources/libraries/python/honeycomb/HoneycombUtil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -62,12 +62,14 @@ class HoneycombError(Exception): When raising this exception, put this information to the message in this order: + - short description of the encountered problem (parameter msg), - relevant messages if there are any collected, e.g., from caught exception (optional parameter details), - relevant data if there are any collected (optional parameter details). - The logging is performed on two levels: 1. error - short description of the - problem; 2. debug - detailed information. + + The logging is performed on two levels: 1. error - short description of the + problem; 2. debug - detailed information. """ def __init__(self, msg, details='', enable_logging=True): @@ -79,7 +81,7 @@ class HoneycombError(Exception): :param msg: Message to be displayed and logged. :param enable_logging: When True, logging is enabled, otherwise - logging is disabled. + logging is disabled. :type msg: str :type enable_logging: bool """ @@ -109,10 +111,11 @@ class HoneycombUtil(object): structure. There are also two supportive methods implemented: - - read_path_from_url_file which reads URL file and returns a path (see - docs/honeycomb_url_files.rst). - - parse_json_response which parses data from response in JSON representation - according to given path. + + - read_path_from_url_file which reads URL file and returns a path (see + docs/honeycomb_url_files.rst). + - parse_json_response which parses data from response in JSON + representation according to given path. """ def __init__(self): @@ -120,11 +123,12 @@ class HoneycombUtil(object): @staticmethod def read_path_from_url_file(url_file): - """Read path from *.url file. + """Read path from .url file. + + For more information about .url file see docs/honeycomb_url_files.rst - For more information about *.url file see docs/honeycomb_url_files.rst :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. + without extension, not the full path. :type url_file: str :returns: Requested path. :rtype: str @@ -143,36 +147,39 @@ class HoneycombUtil(object): Path format: The path is a tuple with items navigating to requested data. The items can be strings or tuples: - - string item represents a dictionary key in data, - - tuple item represents list item in data. - - Example: - data = \ - { - "interfaces": { - "interface": [ - { - "name": "GigabitEthernet0/8/0", - "enabled": "true", - "type": "iana-if-type:ethernetCsmacd", - }, - { - "name": "local0", - "enabled": "false", - "type": "iana-if-type:ethernetCsmacd", - } - ] - } - } + + - string item represents a dictionary key in data, + - tuple item represents list item in data. + + Example:: + + data = \ + { + "interfaces": { + "interface": [ + { + "name": "GigabitEthernet0/8/0", + "enabled": "true", + "type": "iana-if-type:ethernetCsmacd", + }, + { + "name": "local0", + "enabled": "false", + "type": "iana-if-type:ethernetCsmacd", + } + ] + } + } path = ("interfaces", ("interface", "name", "local0"), "enabled") This path points to "false". - The tuple ("interface", "name", "local0") consists of: - index 0 - dictionary key pointing to a list, - index 1 - key which identifies an item in the list, it is also marked as - the key in corresponding yang file. - index 2 - key value. + The tuple ("interface", "name", "local0") consists of:: + + index 0 - dictionary key pointing to a list, + index 1 - key which identifies an item in the list, it is also marked + as the key in corresponding yang file. + index 2 - key value. :param data: Data received from Honeycomb REST API. :param path: Path to data we want to find. @@ -290,13 +297,13 @@ class HoneycombUtil(object): :param node: Honeycomb node. :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. + without extension, not the full path. :param path: Path which is added to the base path to identify the data. :type node: dict :type url_file: str :type path: str :returns: Status code and content of response. - :rtype tuple + :rtype: tuple """ base_path = HoneycombUtil.read_path_from_url_file(url_file) @@ -319,7 +326,7 @@ class HoneycombUtil(object): :param node: Honeycomb node. :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. + without extension, not the full path. :param data: Configuration data to be sent to Honeycomb. :param path: Path which is added to the base path to identify the data. :param data_representation: How the data is represented. @@ -331,7 +338,7 @@ class HoneycombUtil(object): :returns: Status code and content of response. :rtype: tuple :raises HoneycombError: If the given data representation is not defined - in HEADERS. + in HEADERS. """ try: @@ -358,11 +365,11 @@ class HoneycombUtil(object): :param node: Honeycomb node. :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. + without extension, not the full path. :param data: Configuration data to be sent to Honeycomb. :param data_representation: How the data is represented. :param timeout: How long to wait for the server to send data before - giving up. + giving up. :type node: dict :type url_file: str :type data: dict, str @@ -371,7 +378,7 @@ class HoneycombUtil(object): :returns: Status code and content of response. :rtype: tuple :raises HoneycombError: If the given data representation is not defined - in HEADERS. + in HEADERS. """ try: @@ -392,13 +399,13 @@ class HoneycombUtil(object): :param node: Honeycomb node. :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. + without extension, not the full path. :param path: Path which is added to the base path to identify the data. :type node: dict :type url_file: str :type path: str :returns: Status code and content of response. - :rtype tuple + :rtype: tuple """ base_path = HoneycombUtil.read_path_from_url_file(url_file) @@ -411,7 +418,7 @@ class HoneycombUtil(object): :param node: Honeycomb node. :param suite_name: Name of the current test suite. ${SUITE_NAME} - variable in robotframework. + variable in robotframework. :type node: dict :type suite_name: str """ @@ -433,7 +440,8 @@ class HoneycombUtil(object): """Delete the Honeycomb log file for the current test suite. :param node: Honeycomb node. - :type node: dict""" + :type node: dict + """ ssh = SSH() ssh.connect(node) diff --git a/resources/libraries/python/honeycomb/Lisp.py b/resources/libraries/python/honeycomb/Lisp.py index f2fe24caf1..6ff6f834cc 100644 --- a/resources/libraries/python/honeycomb/Lisp.py +++ b/resources/libraries/python/honeycomb/Lisp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -50,7 +50,7 @@ class LispKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. + 200 = OK or 201 = ACCEPTED. """ if data: @@ -142,7 +142,7 @@ class LispKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the return code is not 200:OK - or 404:NOT FOUND. + or 404:NOT FOUND. """ ret_code, data = HcUtil.get_honeycomb_data(node, "config_lisp") @@ -186,7 +186,7 @@ class LispKeywords(object): :param interface: An interface on the node. :param locator_set: Name for the new locator set. :param priority: Priority parameter for the locator. - :param weight. Weight parameter for the locator. + :param weight: Weight parameter for the locator. :type node: dict :type interface: str :type locator_set: str @@ -491,7 +491,7 @@ class LispGPEKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. + 200 = OK or 201 = ACCEPTED. """ if data: @@ -518,7 +518,7 @@ class LispGPEKeywords(object): :returns: LISP GPE operational data. :rtype: bytearray :raises HoneycombError: If the status code in response to GET is not - 200 = OK. + 200 = OK. """ status_code, resp = HcUtil.get_honeycomb_data(node, "oper_lisp_gpe") @@ -540,7 +540,7 @@ class LispGPEKeywords(object): :returns: LISP GPE mapping. :rtype: dict :raises HoneycombError: If the mapping is not present in operational - data. + data. """ data = LispGPEKeywords.get_lispgpe_operational_data(node) @@ -568,7 +568,7 @@ class LispGPEKeywords(object): :returns: LISP GPE config data. :rtype: bytearray :raises HoneycombError: If the status code in response to GET is not - 200 = OK. + 200 = OK. """ status_code, resp = HcUtil.get_honeycomb_data(node, "config_lisp_gpe") @@ -590,7 +590,7 @@ class LispGPEKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the return code is not 200:OK - or 404:NOT FOUND. + or 404:NOT FOUND. """ ret_code, data = HcUtil.get_honeycomb_data(node, "config_lisp_gpe") diff --git a/resources/libraries/python/honeycomb/NAT.py b/resources/libraries/python/honeycomb/NAT.py index 1fb066d10c..6ad9881333 100644 --- a/resources/libraries/python/honeycomb/NAT.py +++ b/resources/libraries/python/honeycomb/NAT.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,7 +41,7 @@ class NATKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not - OK or ACCEPTED. + OK or ACCEPTED. """ if data: @@ -67,7 +67,7 @@ class NATKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the operation fails or the response - is not as expected. + is not as expected. """ status_code, resp = HcUtil.get_honeycomb_data(node, "oper_nat") diff --git a/resources/libraries/python/honeycomb/Netconf.py b/resources/libraries/python/honeycomb/Netconf.py index 770af95afa..742948c6e7 100644 --- a/resources/libraries/python/honeycomb/Netconf.py +++ b/resources/libraries/python/honeycomb/Netconf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -98,9 +98,9 @@ class Netconf(object): :param size: Maximum number of bytes to read in one iteration. :param time_out: Timeout value for getting the complete response. :param err: Error message to provide when timeout is reached. - :type size:int - :type time_out:int - :type err:str + :type size: int + :type time_out: int + :type err: str :returns: Content of response. :rtype: str :raises HoneycombError: If the read process times out. @@ -133,12 +133,12 @@ class Netconf(object): def get_all_responses(self, size=4096, time_out=3): """Read responses from the receive buffer and catenate together - until a read operation times out. + until a read operation times out. :param size: Maximum number of bytes to read in one iteration. :param time_out: Timeout value for getting the complete response. - :type size:int - :type time_out:int + :type size: int + :type time_out: int :returns: Content of response. :rtype: str """ diff --git a/resources/libraries/python/honeycomb/Notifications.py b/resources/libraries/python/honeycomb/Notifications.py index 512a6cbb08..58d835eca0 100644 --- a/resources/libraries/python/honeycomb/Notifications.py +++ b/resources/libraries/python/honeycomb/Notifications.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -57,7 +57,7 @@ class Notifications(Netconf): :param time_out: Timeout value for the read operation in seconds. :type time_out: int - :return: Data received from buffer. + :returns: Data received from buffer. :rtype: str """ diff --git a/resources/libraries/python/honeycomb/Performance.py b/resources/libraries/python/honeycomb/Performance.py index 8fbbbf6a28..391607ff04 100644 --- a/resources/libraries/python/honeycomb/Performance.py +++ b/resources/libraries/python/honeycomb/Performance.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -60,7 +60,7 @@ class Performance(object): :param script: Name of the script to execute. :param cores: Number of processor cores to use. :param reserved: Number of cores reserved for other tasks. Default is 2, - one for system tasks and one for VPP main thread. + one for system tasks and one for VPP main thread. :param args: Sequential arguments for the script. :param kwargs: Named arguments for the script. :type node: dict diff --git a/resources/libraries/python/honeycomb/ProxyARP.py b/resources/libraries/python/honeycomb/ProxyARP.py index 9696bf4238..adc525d279 100644 --- a/resources/libraries/python/honeycomb/ProxyARP.py +++ b/resources/libraries/python/honeycomb/ProxyARP.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -44,7 +44,7 @@ class ProxyARPKeywords(object): :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. + 200 = OK or 201 = ACCEPTED. """ data = { @@ -112,7 +112,7 @@ class ProxyARPKeywords(object): :type state: str :raises ValueError: If the state argument is incorrect. :raises HoneycombError: If the status code in response is not - 200 = OK or 201 = ACCEPTED. + 200 = OK or 201 = ACCEPTED. """ interface = Topology.convert_interface_reference( @@ -166,7 +166,7 @@ class IPv6NDProxyKeywords(object): :param node: Honeycomb node. :param interface: Name of an interface on the node. :param addresses: IPv6 addresses to configure ND proxy with. If no - address is provided, ND proxy configuration will be removed. + address is provided, ND proxy configuration will be removed. :type node: dict :type interface: str :type addresses: list diff --git a/resources/libraries/python/honeycomb/Routing.py b/resources/libraries/python/honeycomb/Routing.py index 4c6a3f205b..520f53e676 100644 --- a/resources/libraries/python/honeycomb/Routing.py +++ b/resources/libraries/python/honeycomb/Routing.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# Copyright (c) 2018 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -46,7 +46,7 @@ class RoutingKeywords(object): :type node: dict :type path: str :type data: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response is not 200 = OK. |