Method: Provision#set_management_ip_pool

Defined in:
lib/ucslib/service/ucs/provision.rb

#set_management_ip_pool(json) ⇒ Object



584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
# File 'lib/ucslib/service/ucs/provision.rb', line 584

def set_management_ip_pool(json)

start_ip 	  = JSON.parse(json)['start_ip']
end_ip   	  = JSON.parse(json)['end_ip']
subnet_mask = JSON.parse(json)['subnet_mask']
gateway  	  = JSON.parse(json)['gateway']

xml_builder = Nokogiri::XML::Builder.new do |xml|
xml.configConfMos('cookie' => "#{@cookie}", 'inHierarchical' => 'true'){
  xml.inConfigs{
    xml.pair('key' => "org-root/ip-pool-ext-mgmt/block-#{start_ip}-#{end_ip}"){
      xml.ippoolBlock('defGw' => "#{gateway}", 'dn' => "org-root/ip-pool-ext-mgmt/block-#{start_ip}-#{end_ip}",
                      'from' => "#{start_ip}", 'status' => 'created', 'subnet' => "#{subnet_mask}", 'to' => "#{end_ip}")
    }
  }
}
end

#Create xml
set_management_ip_pool_xml = xml_builder.to_xml.to_s

#Post
begin
	rest_post(set_management_ip_pool_xml,@url)
rescue Exception => e
	raise "Error #{e}"
end

end