Class: OMF::SFA::Resource::Channel

Inherits:
OComponent show all
Defined in:
lib/omf-sfa/resource/channel.rb

Direct Known Subclasses

Link

Instance Method Summary collapse

Methods inherited from OComponent

#_from_sfa_exo_sliver__geni_sliver_info_property_xml, #clone, #component_name, #create_from_xml, #destroy, #destroy!, #independent_component?, #update_from_xml

Methods included from Base::ClassMethods

#_sfa_add_ns, #_sfa_prefix_for_namespace, #_to_sfa_xml, #default_component_manager_id, #default_domain, #descendants, #from_sfa, #sfa, #sfa_add_namespace, #sfa_add_namespaces_to_document, #sfa_cast_property_value, #sfa_class, #sfa_def_for, #sfa_defs, #sfa_suppress_id, #sfa_suppress_id?, #sfa_suppress_uuid, #sfa_suppress_uuid?, #to_rspec

Methods included from Base::InstanceMethods

#_to_sfa_property_hash, #_to_sfa_xml, #_xml_name, #component_id, #component_manager_id, #default_domain, #from_sfa, #resource_type, #sfa_class, #sfa_id, #sfa_property, #to_sfa_hash, #to_sfa_hash_short, #to_sfa_short_xml, #to_sfa_xml

Methods inherited from OResource

#_dirty_self?, #_oprops_to_hash, #all_resources, #clone, #default_href_prefix, #destroy, #destroy!, #dirty_self?, #each_resource, #group?, #href, href_resolver, init, json_create, #oproperties_as_hash, #oproperty, oproperty, #oproperty_array_get, #oproperty_get, #oproperty_set, prop_all, #remove_from_all_groups, #resource_type, #status, #to_hash, #to_hash_brief, #to_hash_long, #to_json, #uuid

Instance Method Details

#_from_sfa_interfaces_property_xml(resource_el, props, context) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/omf-sfa/resource/channel.rb', line 20

def _from_sfa_interfaces_property_xml(resource_el, props, context)
  resource_el.children.each do |el|
    next unless el.is_a? Nokogiri::XML::Element
    next unless el.name == 'interface_ref' # should check namespace as well

    unless client_id_attr = el.attributes['client_id']
      raise "Expected 'client_id' attr in '#{el}'"
    end
    unless interface = context[client_id_attr.value]
      raise "Referencing unknown interface '#{client_id_attr.value} in '#{el}'"
    end
    #puts "INTERFACE '#{client_id_attr.value}' => '#{interface}'"
    self.interfaces << interface
  end
end

#_to_sfa_property_xml(pname, value, res_el, pdef, obj2id, opts) ⇒ Object

Override xml serialization of ‘interface’



37
38
39
40
41
42
43
44
45
# File 'lib/omf-sfa/resource/channel.rb', line 37

def _to_sfa_property_xml(pname, value, res_el, pdef, obj2id, opts)
  if pname == 'interfaces'
    value.each do |iface|
      iface.to_sfa_ref_xml(res_el, obj2id, opts)
    end
    return
  end
  super
end