X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fhoneycomb%2FHcAPIKwInterfaces.py;h=3a32cbe5ff1c0bc26978b894c17bd1d6529c3c6b;hp=92b1b8019ee29e1a4fee05b9d891ca9cc1158555;hb=e3171449c75d948461ac24b0df7212e8a2ca45f9;hpb=5a6730f9ce36b4d09b121d401209d89288da301b;ds=sidebyside diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index 92b1b8019e..3a32cbe5ff 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -1248,8 +1248,8 @@ class InterfaceKeywords(object): "information about the tag-rewrite.") @staticmethod - def add_ipv4_address_to_sub_interface(node, super_interface, identifier, - ip_addr, network): + def add_ip_address_to_sub_interface(node, super_interface, identifier, + ip_addr, network, ip_version): """Add an ipv4 address to the specified sub-interface, with the provided netmask or network prefix length. Any existing ipv4 addresses on the sub-interface will be replaced. @@ -1259,11 +1259,13 @@ class InterfaceKeywords(object): :param identifier: The ID of sub-interface. :param ip_addr: IPv4 address to be set. :param network: Network mask or network prefix length. + :param ip_version: ipv4 or ipv6 :type node: dict :type super_interface: str :type identifier: int :type ip_addr: str :type network: str or int + :type ip_version: string :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the provided netmask or prefix is not valid. @@ -1273,9 +1275,9 @@ class InterfaceKeywords(object): ("interface", "name", super_interface), "vpp-vlan:sub-interfaces", ("sub-interface", "identifier", int(identifier)), - "ipv4") + ip_version.lower()) - if isinstance(network, basestring): + if isinstance(network, basestring) and ip_version.lower() == "ipv4": address = {"address": [{"ip": ip_addr, "netmask": network}, ]} elif isinstance(network, int) and 0 < network < 33: @@ -1289,16 +1291,18 @@ class InterfaceKeywords(object): node, super_interface, path, address) @staticmethod - def remove_all_ipv4_addresses_from_sub_interface(node, super_interface, - identifier): + def remove_all_ip_addresses_from_sub_interface(node, super_interface, + identifier, ip_version): """Remove all ipv4 addresses from the specified sub-interface. :param node: Honeycomb node. :param super_interface: Super interface. :param identifier: The ID of sub-interface. + :param ip_version: ipv4 or ipv6 :type node: dict :type super_interface: str :type identifier: int + :type ip_version: string :returns: Content of response. :rtype: bytearray """ @@ -1307,7 +1311,7 @@ class InterfaceKeywords(object): ("interface", "name", super_interface), "vpp-vlan:sub-interfaces", ("sub-interface", "identifier", int(identifier)), - "ipv4", "address") + str(ip_version), "address") return InterfaceKeywords._set_interface_properties( node, super_interface, path, None)