-# 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:
: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.\
put_honeycomb_data(node, "config_bridge_domain", data,
data_representation=data_representation)
- if status_code != HTTPCodes.OK:
+ if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED):
raise HoneycombError(
"The configuration of bridge domain '{0}' was not successful. "
"Status code: {1}.".format(bd_name, status_code))
: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.
"""
status_code, resp = HcUtil.\
get_honeycomb_data(node, "config_bridge_domain")
- if status_code != HTTPCodes.OK:
+ if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED):
raise HoneycombError(
"Not possible to get configuration information about the "
"bridge domains. Status code: {0}.".format(status_code))
: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
"""
: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.
"""
: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
"""
: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.
"""
"Not possible to get operational information about the "
"bridge domains. Status code: {0}.".format(status_code))
try:
- return resp["bridge-domains"]["bridge-domain"]
+ return resp["bridge-domains-state"]["bridge-domain"]
except (KeyError, TypeError):
return []
: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
"""
: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
"""
- path = ("bridge-domains", )
new_bd = BridgeDomainKeywords._create_bd_structure(bd_name, **kwargs)
- bridge_domain = {"bridge-domain": [new_bd, ]}
- return BridgeDomainKeywords._set_bd_properties(node, bd_name, path,
- bridge_domain)
+ bridge_domain = {"bridge-domains": {"bridge-domain": [new_bd, ]}}
+ return BridgeDomainKeywords._configure_bd(node, bd_name, bridge_domain)
@staticmethod
def add_bd(node, bd_name, **kwargs):
: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
"""
bridge_domain)
@staticmethod
- def remove_all_bds(node):
+ def remove_all_bridge_domains(node):
"""Remove all bridge domains.
: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": []}}
+
status_code, resp = HcUtil.\
put_honeycomb_data(node, "config_bridge_domain", data)
- if status_code != HTTPCodes.OK:
+
+ if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED):
raise HoneycombError("Not possible to remove all bridge domains. "
"Status code: {0}.".format(status_code))
return resp
: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))
: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
"""
:type node: dict
:type bd_name: str
:type l2_fib_entry: dict
- :return: Content of response.
+ :returns: Content of response.
:rtype: bytearray
"""
:type mac: str
:type param: str
:type value: str or int
- :return: Content of response.
+ :returns: Content of response.
:rtype: bytearray
"""
: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",
:param bd_name: Bridge domain's name.
:type node: dict
:type bd_name: str
- :return: Content of response.
+ :returns: Content of response.
:rtype: bytearray
"""
: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
"""
: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
"""