Class: OMF::SFA::Resource::Interface
- Inherits:
-
OComponent
- Object
- OResource
- OComponent
- OMF::SFA::Resource::Interface
- Defined in:
- lib/omf-sfa/resource/interface.rb
Instance Method Summary collapse
- #_from_sfa_ip_property_xml(resource_el, props, context) ⇒ Object
-
#_to_sfa_property_xml(pname, value, res_el, pdef, obj2id, opts) ⇒ Object
Override xml serialization of ‘ip’.
- #independent_component? ⇒ Boolean
- #sliver ⇒ Object
- #to_sfa_ref_xml(res_el, obj2id, opts) ⇒ Object
Methods inherited from OComponent
#clone, #component_name, #create_from_xml, #destroy, #destroy!, #update_from_xml
Methods included from Base::ClassMethods
#_sfa_add_ns, #_to_sfa_xml, #default_component_manager_id, #default_domain, #descendants, #from_sfa, #sfa, #sfa_add_namespace, #sfa_add_namespaces_to_document, #sfa_advertisement_xml, #sfa_cast_property_value, #sfa_class, #sfa_def_for, #sfa_defs
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, 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_ip_property_xml(resource_el, props, context) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/omf-sfa/resource/interface.rb', line 52 def _from_sfa_ip_property_xml(resource_el, props, context) resource_el.children.each do |el| next unless el.is_a? Nokogiri::XML::Element next unless el.name == 'ip' # should check namespace as well unless address_attr = el.attributes['address'] raise "Expected 'address' attr for ip in '#{el}'" end address = address_attr.value ip = self.ip_addresses.find do |r| r.address == address end unless ip # doesn't exist yet, create new one ip = Ip.new(:interface => self) end #puts "IP -----" ip.from_sfa(el) #puts "IP '#{ip.inspect}'" self.ip_addresses << ip end end |
#_to_sfa_property_xml(pname, value, res_el, pdef, obj2id, opts) ⇒ Object
Override xml serialization of ‘ip’
44 45 46 47 48 49 50 |
# File 'lib/omf-sfa/resource/interface.rb', line 44 def _to_sfa_property_xml(pname, value, res_el, pdef, obj2id, opts) if pname == 'ip' value.to_sfa_xml(res_el, obj2id, opts) return end super end |
#independent_component? ⇒ Boolean
29 30 31 |
# File 'lib/omf-sfa/resource/interface.rb', line 29 def independent_component? false end |
#sliver ⇒ Object
16 17 18 |
# File 'lib/omf-sfa/resource/interface.rb', line 16 def sliver node.sliver end |
#to_sfa_ref_xml(res_el, obj2id, opts) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/omf-sfa/resource/interface.rb', line 33 def to_sfa_ref_xml(res_el, obj2id, opts) if obj2id.key?(self) el = res_el.add_child(Nokogiri::XML::Element.new('interface_ref', res_el.document)) el.set_attribute('component_id', self.component_id.to_s) el.set_attribute('id_ref', self.uuid.to_s) else self.to_sfa_xml(res_el, obj2id, opts) end end |