diff options
author | Tibor Frank <tifrank@cisco.com> | 2016-05-12 11:49:48 +0200 |
---|---|---|
committer | Matej Klotton <mklotton@cisco.com> | 2016-05-12 13:15:42 +0000 |
commit | 97c8c74e4f813a259ca825e831f83d546d96a171 (patch) | |
tree | 92458f93dfb674bed6ddda8b61ea22b3213f3924 | |
parent | 331358b445959203d1642e0f7b89bc8d1cc4ef13 (diff) |
Add possibility to change VxLAN parameters at once
JIRA: CSIT-51
- modify existing keyword "configure_interface_vxlan" to be able to:
- configure all VxLAN parameters at once
- configure VxLAN parameters one by one
- remove a parameter
- remove all parameters at once
Change-Id: I50551fbc3ae5c6aa147d531fc66b583af36bb541
Signed-off-by: Tibor Frank <tifrank@cisco.com>
-rw-r--r-- | resources/libraries/python/honeycomb/HcAPIKwInterfaces.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index b1dd5b5dd1..854bc07ee6 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -674,30 +674,38 @@ class InterfaceKeywords(object): node, interface, path, value) @staticmethod - def configure_interface_vxlan(node, interface, param, value): - """Configure the VxLAN parameters of interface. + def configure_interface_vxlan(node, interface, **kwargs): + """Configure VxLAN on the interface. + + The keyword configures VxLAN parameters on the given interface. The type + of interface must be set to "v3po:vxlan-tunnel". + The new VxLAN parameters overwrite the current configuration. If a + parameter in new configuration is missing, it is removed from VxLAN + configuration. + If the dictionary kwargs is empty, VxLAN configuration is removed. :param node: Honeycomb node. :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. + :param kwargs: Parameters and their values. The accepted parameters are + defined in InterfaceKeywords.VXLAN_PARAMS. :type node: dict :type interface: str - :type param: str - :type value: str + :type kwargs: dict :return: Content of response. :rtype: bytearray :raises HoneycombError: If the parameter is not valid. """ - if param not in InterfaceKeywords.VXLAN_PARAMS: - raise HoneycombError("The parameter {0} is invalid.".format(param)) + vx_lan_structure = dict() + for param, value in kwargs.items(): + if param not in InterfaceKeywords.VXLAN_PARAMS: + raise HoneycombError("The parameter {0} is invalid.". + format(param)) + vx_lan_structure[param] = value - path = ("interfaces", ("interface", "name", interface), "v3po:vxlan", - param) + path = ("interfaces", ("interface", "name", interface), "v3po:vxlan") return InterfaceKeywords._set_interface_properties( - node, interface, path, value) + node, interface, path, vx_lan_structure) @staticmethod def configure_interface_l2(node, interface, param, value): |