Software Defined Networking
1827650 Members
3270 Online
109966 Solutions
New Discussion

how can I make more than two flows using rest api?

 
sylee
Regular Visitor

how can I make more than two flows using rest api?

I can make one flow as below

 

{

"flow": {
"priority": 30000,
"table_id": 200,
"idle_timeout": 60,
"match": [
{ "ipv4_src": "10.0.0.1"},
{"ipv4_dst": "10.0.0.22"},
{"ip_proto": "tcp"},
{"eth_type": "ipv4"},
{"tcp_dst": "80"}],
"instructions": [{"apply_actions": [{"output": 1}]}]
}

}

 

I made two flows as below but..

{

"flow": [

{
"priority": 30000,
"table_id": 200,
"idle_timeout": 60,
"match": [
{ "ipv4_src": "10.0.0.1"},
{"ipv4_dst": "10.0.0.22"},
{"ip_proto": "tcp"},
{"eth_type": "ipv4"},
{"tcp_dst": "80"}],
"instructions": [{"apply_actions": [{"output": 1}]}]
},

{
"priority": 30000,
"table_id": 200,
"idle_timeout": 60,
"match": [
{ "ipv4_src": "10.0.0.5"},
{"ipv4_dst": "10.0.0.3"},
{"ip_proto": "tcp"},
{"eth_type": "ipv4"},
{"tcp_dst": "80"}],
"instructions": [{"apply_actions": [{"output": 5}]}]
}

]

}

 

I couldn't make it.  it's failed 

how to make more than two flows?

 

4 REPLIES 4
piricchio72
Valued Contributor

Re: how can I make more than two flows using rest api?

Hello,

 

How are you trying to add these flows?

Do you get an error message?

 

Regards,

 

Antonio

 

SDN CoE Team

 

sylee
Regular Visitor

Re: how can I make more than two flows using rest api?

I made two examples('flow' or 'flows').

 


First,

------------------------------------------------------------------------------------------------------

{
"flow": [
{
"priority": 30000,
"table_id": 200,
"idle_timeout": 60,
"match": [
{ "ipv4_src": "10.0.0.1"},
{"ipv4_dst": "10.0.0.22"},
{"ip_proto": "tcp"},
{"eth_type": "ipv4"},
{"tcp_dst": "80"}],
"instructions": [{"apply_actions": [{"output": 1}]}]
},

{
"priority": 30000,
"table_id": 200,
"idle_timeout": 60,
"match": [
{ "ipv4_src": "10.0.0.5"},
{"ipv4_dst": "10.0.0.3"},
{"ip_proto": "tcp"},
{"eth_type": "ipv4"},
{"tcp_dst": "80"}],
"instructions": [{"apply_actions": [{"output": 5}]}]
}
]
}

------------------------------------------------------------------------------------------------------

Response Body

[unable to parse as json; raw response below]

HTTP Status 500 - com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to com.fasterxml.jackson.databind.node.ObjectNode


type Exception report

message com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to com.fasterxml.jackson.databind.node.ObjectNode

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.ClassCastException: com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to com.fasterxml.jackson.databind.node.ObjectNode
	com.hp.of.json.OfJsonCodec.decode(OfJsonCodec.java:55)
	com.hp.of.json.OfJsonCodec.decode(OfJsonCodec.java:42)
	com.hp.util.json.JSON.fromJson(JSON.java:68)
	com.hp.sdn.rs.FlowProvider.update(FlowProvider.java:87)
	com.hp.sdn.rs.DatapathsResource.updateFlow(DatapathsResource.java:395)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:606)
	com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
	com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
	com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
	com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
	com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
	com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
	com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	com.hp.util.rs.SecurityFilter.doFilter(SecurityFilter.java:94)
	com.hp.util.rs.auth.AbstractTokenAuthFilter.doFilter(AbstractTokenAuthFilter.java:106)

 

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.35 logs.

Response Code

500

 

*************************************************************************************************

 

Second,

------------------------------------------------------------------------------------------------------

{
"flows": [
{
"priority": 30000,
"table_id": 200,
"idle_timeout": 60,
"match": [
{ "ipv4_src": "10.0.0.1"},
{"ipv4_dst": "10.0.0.22"},
{"ip_proto": "tcp"},
{"eth_type": "ipv4"},
{"tcp_dst": "80"}],
"instructions": [{"apply_actions": [{"output": 1}]}]
},

{
"priority": 30000,
"table_id": 200,
"idle_timeout": 60,
"match": [
{ "ipv4_src": "10.0.0.5"},
{"ipv4_dst": "10.0.0.3"},
{"ip_proto": "tcp"},
{"eth_type": "ipv4"},
{"tcp_dst": "80"}],
"instructions": [{"apply_actions": [{"output": 5}]}]
}
]
}

------------------------------------------------------------------------------------------------------

 

Respose Body

{
"message": "Invalid JSON format: Invalid JSON format: {\"version\":\"1.3.0\",\r\n\"flows\": [\r\n{\r\n\"priority\": 30000,\r\n\"table_id\": 200,\r\n\"idle_timeout\": 60,\r\n\"match\": [\r\n{ \"ipv4_src\": \"10.0.0.1\"},\r\n{\"ipv4_dst\": \"10.0.0.22\"},\r\n{\"ip_proto\": \"tcp\"},\r\n{\"eth_type\": \"ipv4\"},\r\n{\"tcp_dst\": \"80\"}],\r\n\"instructions\": [{\"apply_actions\": [{\"output\": 1}]}]\r\n},\r\n\r\n{\r\n\"priority\": 30000,\r\n\"table_id\": 200,\r\n\"idle_timeout\": 60,\r\n\"match\": [\r\n{ \"ipv4_src\": \"10.0.0.5\"},\r\n{\"ipv4_dst\": \"10.0.0.3\"},\r\n{\"ip_proto\": \"tcp\"},\r\n{\"eth_type\": \"ipv4\"},\r\n{\"tcp_dst\": \"80\"}],\r\n\"instructions\": [{\"apply_actions\": [{\"output\": 5}]}]\r\n}\r\n]\r\n}\r\n. Please refer to the HP VAN SDN Controller JSON schema for more information."
}

 

ResPonse Code

400

*************************************************************************************************

 

how to make two flowJson? Could I make it possible?

 

 

piricchio72
Valued Contributor

Re: how can I make more than two flows using rest api?

Hello,

 

At the moment I am researching your issue with our engineering department. Once I get an answer from our team I will contact you.

 

Best Regards,

 

Antonio

CSC CoE SDN

piricchio72
Valued Contributor

Re: how can I make more than two flows using rest api?

Hello sylee,

 

I just received a confirmation that unfortunately adding more than one flow via the Rest API is not supported.

 

Regards,

 

Antonio

SDN Team