def test_validate_payload_v6(self, mock_session): mock_session.return_value.get.side_effect = get_side_effect mock_session.return_value.post.side_effect = post_side_effect VraConfig(get_test_config_file_path()) auth = VraAuthenticate('PRD').auth_login_password( 'fake_login', 'fake_password', 'foo.fuu.com') sdk = VraSdk(auth, 'fake_bg') data = { "payload_version": 6, "provider-fake_data1": "fake_value1", "fake_data2": 122 } fake_item_request = sdk.request_catalog_item("fake_catalog_item", **data) self.assertTrue( self.validator.catalog_item(fake_item_request.payload.customized)) fake_action_request = sdk.request_resource_action( "fake_action_name", "fake_resource_id", **data) self.assertTrue( self.validator.resource_action( fake_action_request.payload.customized))
# you can either get the data as dict or as json pprint(vm_data.to_json()) pprint(vm_data.to_dict()) ###### # get list of vm vm_list = my_client.get_data('vm', None, None) for vm in vm_list: print(vm.name) ###### # request a resource action param = {"my_param_key": "my_param_value"} req = my_client.request_resource_action("My_resource_action_name", vm_data.id, **param) pprint(req.payload.customized ) # hake a look at the payload (by default vRa7 format) req.execute_async() # execute the request without hanging pprint(req.status_url) # get the request status url ###### # request a catalog item param = { "NbMachine": 1, "LeaseDays": 1, "Environment": "DEV", "Size": "", "DataDiskSize": 20, } # if i have added 'payload_version':6 to my param dict, the request would have generate a vRa6 payload object