Problem with CALL apoc.do.when

Hello,
I am new to neo4j cypher, and i try to construct a graph with multiple use of the apoc.do.when, but i have a problem, the error is :

Expected parameter(s): CT, vm_src, vm_dest, app_src, app_dest

And my cypher script is :

LOAD CSV WITH HEADERS FROM "file:///input.csv" AS CT

//Create vm
MERGE (vm_src:VM {name : CT.hostname_source})
MERGE (vm_dest:VM {name : CT.hostname_dest})

WITH vm_src, vm_dest

// create app with label Unknown_appli	
CALL apoc.do.when($CT.source_appli_name = "unknown_appli", 
'MERGE (app_src:App:Unknown_appli{name: "CT.hostname_source"}) RETURN app_src',
'MERGE (app_src:App{name:"CT.source_appli_name"}) RETURN app_src',
{CT:$CT}) YIELD value
WITH value.app_src as app_src

CALL apoc.do.when($CT.appli_name_dest = "unknown_appli" , 
'MERGE (app_dest:App:Unknown_appli{name: "CT.hostname_dest"}) RETURN app_dest',
'MERGE (app_dest:App{name: "CT.appli_name_dest"}) RETURN app_dest',
{CT:$CT}) YIELD value
WITH value.app_dest as app_dest


//create calls relations
CALL apoc.do.when($CT.direction = "IN" AND $vm_src.name <> $vm_dest.name , 
		'MERGE ($vm_dest)-[:CALLS]->($vm_src) RETURN $vm_dest', '',
        {CT:$CT,vm_src:$vm_src, vm_dest:$vm_dest}) YIELD value
WITH value as ignored

CALL apoc.do.when($CT.direction = "IN" AND $app_src.name <> $app_dest.name, 
		'MERGE (app_dest)-[:CALLS]->(app_src) RETURN app_dest', '', 
        {CT:$CT,app_src:$app_src, app_dest:$app_dest}) YIELD value
WITH value as ignored1
		  

CALL apoc.do.when($CT.direction = "OUT" AND $vm_src.name <> $vm_dest.name, 
		'MERGE ($vm_src)-[:CALLS]->($vm_dest) RETURN $vm_src', '', 
        {CT:$CT,vm_src:$vm_src,vm_dest:$vm_dest}) YIELD value
WITH value as ignored2

CALL apoc.do.when($CT.direction = "OUT" AND $app_src.name <> $app_dest.name , 
		'MERGE (app_src)-[:CALLS]->(app_dest) RETURN app_src', '', 
        {CT:$CT,app_src:$app_src,app_dest:$app_dest}) YIELD value
WITH value as ignored3

//create child relations
MERGE (app_src)-[:CONTAINS]->(vm_src)
MERGE (app_dest)-[:CONTAINS]->(vm_dest)

Any help please ?

Your cypher is expecting that anything with a $ in front of it is a supplied parameter or variable. The error is telling you that you're not actually supplying those parameters. If you're loading from a csv take a look at this example and how the variables are declared from the CSV row Importing CSV Data into Neo4j - Developer Guides.

I didn't find how to use variables in th doc?

Try below

IF you need to pass variable name in the query with value of name as Madiskou, then try as
:param name=>'Madiskou';
Match(n:Person{Name:$name})
Return n

Above query will find all the Node of Label Person have name as Madiskou.
Also If possible then rename the topic

The example in the docs show's how to use property from a row as a variable like:

LOAD CSV WITH HEADERS FROM 'file:///data.csv' AS row
WITH row WHERE row.Company IS NOT NULL
MERGE (c:Company {companyId: row.Id})

In your case it would be like you've show in your code:

 CT.<your variable here> 

I'm not sure why you're using $.

CT is in scope from your LOAD_CSV, at least for awhile.

One big critical problem here is that you're eliminating variables from scope via your WITH clauses. WITH restricts what is in scope, so as soon as you reach WITH vm_src, vm_dest, CT is no longer in scope and you can't use it further in your query. If you need to use a variable later on, you must include it in your WITH clause otherwise it's out of scope.

You have similar problems with your other WITH clauses.

As was mentioned by others, you don't need to use parameter syntax here, use just CT instead of $CT.