Software Defined Networking
1828019 Members
2122 Online
109973 Solutions
New Discussion

Re: CURL with an drop "apply_actions"

 
SOLVED
Go to solution
sbotkine
Frequent Advisor

CURL with an drop "apply_actions"

Hello, 

 

I don't know how to add "drop" as an apply_actions:

 

 

curl --noproxy 130.223.16.128 --header 'X-Auth-Token: a97daad3ea18489eb38c8c6a7ae5236e' --header "Accept: application/json" --header "Content-type: application/json" --fail -ksSfL -X POST -d '{"flow":{"priority":20,"table_id":100,"idle_timeout":60,"match":[{"eth_type":"arp"}],"instructions":[{"apply_actions":[{"drop"}]}]}}' --url https://130.223.16.128:8443/sdn/v2.0/of/datapaths/00:14:f0:92:1c:21:fa:c0/flows

 

I obtained:  curl: (22) The requested URL returned error: 400 Bad Request

 

Do you know how to do that ?

5 REPLIES 5
ShaunWackerly
HPE Pro
Solution

Re: CURL with an drop "apply_actions"

Hi sbotkine,

 

The way to accomplish a drop is with an empty list of actions. That's the way it's accomplished in the OpenFlow spec, so that's how it's accomplished through the controller's REST API as well.

I am an HPE Employee
sdnindia
Trusted Contributor

Re: CURL with an drop "apply_actions"

Hello sbotkine,

 

We hope the response from Shaun answers your query.

Please feel free to reply incase you have more questions around the same topic or open a new thread if new topic.

 

Thanks

HP SDN Team

Dave-B
Frequent Advisor

Re: CURL with an drop "apply_actions"

Please can you give an example of the curl command for this.

I keep getting ivaliud json format.

 

Cheers,

Dave.

piricchio72
Valued Contributor

Re: CURL with an drop "apply_actions"

 

Hi,

 

as per the answer already marked as the solution of this thread, please just leave the apply_action section empty.

This will drop packets:

 

curl --noproxy 130.223.16.128 --header 'X-Auth-Token: a97daad3ea18489eb38c8c6a7ae5236e' --header "Accept: application/json" --header "Content-type: application/json" --fail -ksSfL -X POST -d '{"flow":{"priority":20,"table_id":100,"idle_timeo​ut":60,"match":[{"eth_type":"arp"}],"instructions"​:[{"apply_actions":[{""}]}]}}'

 

Regards,

 

Antonio

SDN Team

Dave-B
Frequent Advisor

Re: CURL with an drop "apply_actions"

OK, I worked it out.

 

To add or remove a drop action for specific IP or IP range>

 

curl --header "X-Auth-Token:$AUTH_TOKEN" -H "Content-Type:application/json" -ksS --url "https://$CONTROLER_IP:8443/sdn/v2.0/of/datapaths/$SW_DPID/flows" -d "{\"flow\": {\"priority\": 20100,\"table_id\":100,\"idle_timeout\": 60000,\"match\": [{\"ipv4_dst\":\"10.0.0.120\",\"mask\":\"255.255.255.255\"},{\"eth_type\": \"ipv4\"}]}}" --request POST


curl --header "X-Auth-Token:$AUTH_TOKEN" -H "Content-Type:application/json" -ksS --url "https://$CONTROLER_IP:8443/sdn/v2.0/of/datapaths/$SW_DPID0/flows" -d "{\"flow\": {\"priority\": 20100,\"table_id\":100,\"idle_timeout\": 60000,\"match\": [{\"ipv4_dst\":\"10.1.0.120\",\"mask\":\"255.255.255.255\"},{\"eth_type\": \"ipv4\"}]}}" --request DELETE

 

Dave.