def build_and_add_attrs_to_node(attrs, pn): for attr_defn in attrs: assert 'attr_id' in attr_defn assert 'monitorCycleSeconds' in attr_defn assert 'units' in attr_defn attr_id = attr_defn['attr_id'] pn.add_attribute(AttrNode(attr_id, attr_defn))
def build_and_add_attrs_to_node(attrs, pn): for attr_defn in attrs: attr_id = _get_attr_id(attr_defn) _require('monitor_cycle_seconds' in attr_defn) _require('units' in attr_defn) if isinstance(attr_defn, OrderedDict): attr_defn = dict(attr_defn) pn.add_attribute(AttrNode(attr_id, attr_defn))
def _add_attrs_to_platform_node(attrs, pn): for attr_defn in attrs: attr_id = _get_attr_id(attr_defn) _require('monitor_cycle_seconds' in attr_defn, "_add_attrs_to_platform_node(): 'monitor_cycle_seconds' not in attr_defn") _require('units' in attr_defn, "_add_attrs_to_platform_node(): 'units' not in attr_defn") pn.add_attribute(AttrNode(attr_id, attr_defn))
def set_attributes(pnode): platform_id = pnode.platform_id attr_infos = rsn_oms.get_platform_attributes(platform_id) if not isinstance(attr_infos, dict): log.warn("%r: get_platform_attributes returned: %s", platform_id, attr_infos) return if log.isEnabledFor(logging.TRACE): log.trace("%r: attr_infos: %s", platform_id, attr_infos) assert platform_id in attr_infos ret_infos = attr_infos[platform_id] for attrName, attr_defn in ret_infos.iteritems(): attr = AttrNode(attrName, attr_defn) pnode.add_attribute(attr)
def set_attributes(pnode): platform_id = pnode.platform_id attr_infos = rsn_oms.attr.get_platform_attributes(platform_id) if not isinstance(attr_infos, dict): raise PlatformDriverException( "%r: get_platform_attributes returned: %s" % (platform_id, attr_infos)) if log.isEnabledFor(logging.TRACE): log.trace("%r: attr_infos: %s", platform_id, attr_infos) if not platform_id in attr_infos: raise PlatformDriverException( "%r: get_platform_attributes response does not " "include entry for platform_id: %s" % (platform_id, attr_infos)) ret_infos = attr_infos[platform_id] for attrName, attr_defn in ret_infos.iteritems(): attr = AttrNode(attrName, attr_defn) pnode.add_attribute(attr)
def _add_attrs_to_platform_node(attrs, pn): for attr_defn in attrs: attr_id = _get_attr_id(attr_defn) assert 'monitor_cycle_seconds' in attr_defn assert 'units' in attr_defn pn.add_attribute(AttrNode(attr_id, attr_defn))