Action()
{
lr_start_transaction("zion_setvlan");
web_set_timeout(STEP,
"45");
lr_rendezvous("Collection point for posting flow tables");
web_add_header("Authorization",
"Basic YWRtaW46YWRtaW4=");
web_add_header("Content-Type",
"json/application");
web_reg_find("Search=Body",
"SaveCount=RecordSave",
"Text=OK",
LAST);
web_custom_request("web_custom_request",
"URL=http://172.16.1.184:8181/zion/restconf/config/zion-inventory:nodes/node/openflow:79/table/0/flow/{flowid}",
"Method=PUT",
"TargetFrame=",
"Resource=0",
"Referer=",
"EncType=json/application",
"Body={\"flow\":[{\"id\":\"{flowid}\",\"flow-name\":\"{flowid}\",\"priority\":{flowid},\"table_id\":0,\"hard-timeout\":0,\"idle-timeout\":0,\"match\":{\"ethernet-match\":{\"ethernet-type\":{\"type\":2048}},\"vlan-match\":{\"vlan-id\":{\"vlan-id\":{flowid},\"vlan-id-present\":true}}},\"instructions\":{\"instruction\":[{\"order\":0,\"apply-actions\":{\"action\":[{\"set-vlan-id-action\":{\"vlan-id\":1024},\"order\":0},{\"output-action\":{\"output-node-connector\":\"10\"},\"order\":0}]}}]}}]}",
LAST);
if(atoi(lr_eval_string("{RecordSave}"))>0){
lr_end_transaction("zion_setvlan",LR_PASS);
lr_output_message("The flow table %s issuance successfully!",lr_eval_string("{flowid}"));
}
else{
lr_end_transaction("zion_setvlan",LR_FAIL);
lr_error_message("The flow table %s issuance failed!",lr_eval_string("{flowid}"));
}
return 0;
}