Martha Chumo created DTACLOUD-470:
-------------------------------------

             Summary: CIMI: creating networks returing 412.
                 Key: DTACLOUD-470
                 URL: https://issues.apache.org/jira/browse/DTACLOUD-470
             Project: DeltaCloud
          Issue Type: Bug
          Components: Client (Ruby)
            Reporter: Martha Chumo
            Assignee: Marios Andreou


This is code I'm using to create the network:

clients/cimi/lib/entities/network.rb

post '/cimi/networks' do
    network_xml = Nokogiri::XML::Builder.new do |xml|
      xml.Network(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
        xml.name params[:network][:name]
        xml.description params[:network][:description]
        xml.networkTemplate {
          xml.networkConfig( :href => params[:network][:network_configuration] )
          xml.forwardingGroup( :href => params[:network][:forwarding_group] )
        }
      }
    end.to_xml
    begin
      result = create_entity('networks', network_xml, credentials)
      network = CIMI::Model::NetworkCollection.from_xml(result)
      flash[:success] = "Network was successfully created."
      redirect "/cimi/networks/#{network.name}", 302
    rescue => e
      flash[:error] = "Network cannot be created: #{e.message}"
      redirect :back
    end
  end

 get '/cimi/networks' do
    forwarding_groups_xml = get_entity_collection('forwarding_groups', 
credentials)
    @forwarding_groups = 
CIMI::Model::ForwardingGroupCollection.from_xml(forwarding_groups_xml)
    network_config_xml = get_entity_collection('network_configurations', 
credentials)
    @network_configurations = 
CIMI::Model::NetworkConfigurationCollection.from_xml(network_config_xml)
    networks_xml = get_entity_collection('networks', credentials)
    @networks = CIMI::Model::NetworkCollection.from_xml(networks_xml)
    haml :'networks/index'
  end

In the index page, I am using @network_configurations and @forwarding_groups to 
create the network form a modal. 

This is the response from server:

127.0.0.1 - - [13/Feb/2013 11:31:02] "POST /cimi/networks HTTP/1.1" 412 60 
0.0733

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to