Class: OMF::SFA::Resource::Link
- Inherits:
-
Channel
- Object
- OResource
- OComponent
- Channel
- OMF::SFA::Resource::Link
- Defined in:
- lib/omf-sfa/resource/link.rb
Overview
</link>
Instance Method Summary collapse
-
#_to_sfa_xml_component_manager(res_el, pdef, obj2id, opts) ⇒ Object
Override xml serialization of ‘component_manager’.
- #_to_sfa_xml_one_way_property(res_el, source, dest, capacity, latency, packet_loss) ⇒ Object
-
#_to_sfa_xml_property(res_el, pdef, obj2id, opts) ⇒ Object
Override xml serialization of ‘property’.
Methods inherited from Channel
#_from_sfa_interfaces_property_xml, #_to_sfa_property_xml
Methods inherited from OComponent
#_from_sfa_exo_sliver__geni_sliver_info_property_xml, #_to_sfa_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_property_xml, #_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
#_to_sfa_xml_component_manager(res_el, pdef, obj2id, opts) ⇒ Object
Override xml serialization of ‘component_manager’
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/omf-sfa/resource/link.rb', line 30 def _to_sfa_xml_component_manager(res_el, pdef, obj2id, opts) cms = Set.new self.interfaces.each do |ifs| cms << ifs.node.component_manager end cms.each do |cm| next unless cm # not sure if 'nil' could show up her el = res_el.add_child(Nokogiri::XML::Element.new('component_manager', res_el.document)) el.set_attribute('name', cm) end end |
#_to_sfa_xml_one_way_property(res_el, source, dest, capacity, latency, packet_loss) ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/omf-sfa/resource/link.rb', line 55 def _to_sfa_xml_one_way_property(res_el, source, dest, capacity, latency, packet_loss) # <property source_id="n7:if1" dest_id="n6:if2" capacity="10" latency="20" packet_loss="0.3"/> el = res_el.add_child(Nokogiri::XML::Element.new('property', res_el.document)) el.set_attribute('source_id', source.client_id) el.set_attribute('dest_id_id', dest.client_id) el.set_attribute('capacity', capacity.to_i) if capacity el.set_attribute('latency', latency.to_i) if latency el.set_attribute('packet_loss', packet_loss) if packet_loss end |
#_to_sfa_xml_property(res_el, pdef, obj2id, opts) ⇒ Object
Override xml serialization of ‘property’
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/omf-sfa/resource/link.rb', line 44 def _to_sfa_xml_property(res_el, pdef, obj2id, opts) capacity = self.capacity latency = self.latency packet_loss = self.packet_loss if capacity || latency || packet_loss source, dest = self.interfaces.to_a _to_sfa_xml_one_way_property(res_el, source, dest, capacity, latency, packet_loss) _to_sfa_xml_one_way_property(res_el, dest, source, capacity, latency, packet_loss) end end |