Ejemplo n.º 1
0
 def display_configure_occi(self):
     """Display OCCI configuration menu"""
     occi_entry = Entry(30, c('occi', 'server'))
     occi_input_entry = Entry(30, c('occi', 'input_rendering'))
     occi_output_entry = Entry(30, c('occi', 'output_rendering'))
     command, _ = EntryWindow(self.screen, TITLE, 'Please, enter OCCI endpoint parameters',
             [('OCCI endpoint', occi_entry),
              ('OCCI input rendering', occi_input_entry),
              ('OCCI output rendering', occi_output_entry)], 
             buttons = [('Save', 'save'), ('Back', 'main_menu')])
     if command == 'save':
         cs('occi', 'server', occi_entry.value().strip())
         cs('occi', 'input_rendering', occi_input_entry.value().strip())
         cs('occi', 'output_rendering', occi_output_entry.value().strip())
     self.display_main_screen()
Ejemplo n.º 2
0
 def display_configure_cdmi(self):
     """Display CDMI configuration menu"""
     cdmi_entry = Entry(30, c('cdmi', 'cdmi_server'))
     cdmi_user_entry = Entry(30, c('cdmi', 'username'))
     cdmi_pass_entry = Entry(30, c('cdmi', 'password'))
     command, _ = EntryWindow(self.screen, TITLE, 'Please, enter CDMI endpoint parameters',
             [('CDMI endpoint', cdmi_entry),
              ('Username', cdmi_user_entry),
              ('Password', cdmi_pass_entry)], 
             buttons = [('Save', 'save'), ('Back', 'main_menu')])
     if command == 'save':
         cs('cdmi', 'server', cdmi_entry.value().strip())
         cs('cdmi', 'username', cdmi_user_entry.value().strip())
         cd('cdmi', 'password', cdmi_pass_entry.value().strip())
     self.display_main_screen()
Ejemplo n.º 3
0
	def test_create(self, input_rendering = c('occi', 'input_rendering'), 
			      output_rendering = c('occi', 'output_rendering')):

        	net_category = c('occi', 'network_category')
	        net_attributes = c('occi', 'network_attribute')
        	endpoint = '%s/%s' %(c('occi', 'server'), c('occi', 'network_location'))

        	headers = {'Accept': output_rendering,
                	   'Category': net_category
                     	} 
        	resp = None
        	if input_rendering == 'text/occi':
			headers['Content-Type'] = input_rendering
			headers['X-OCCI-Attribute'] = net_attributes
			# XXX seems strange that creation is done via POST
			resp = self.post(path = endpoint, headers = headers)
		elif input_rendering == 'text/plain':
			post_parameters = {'Category': net_category,
                               		   'X-OCCI-Attribute': net_attributes
					  }
		resp = self.post(path = endpoint, headers = headers, post_params = post_parameters)
		resp.assertInBody("Location")