Software Defined Networking
1755364 Members
3736 Online
108832 Solutions
New Discussion юеВ

How to create a MULTIPART_REQUEST of type AGGREGATE?

 
checho88
Occasional Contributor

How to create a MULTIPART_REQUEST of type AGGREGATE?

Hi, I'd like to know how to create a Multipart Request message of type Aggregate (OF 1.3 spec page 64). In particular, I want to aggregate the statistics of flows that match on cookie and a cookie mask. I can see a lot of classes implementing the interface MultipartBody but none of them is for the type Aggregate ( representing "ofp_aggregate_stats_request" in the spec). 

The closest one is MbodyMutableFlowStatsRequest, but after the OF message is sent, the response will include an array multiple flows rather than the aggregated counters with no array. 

I'd like to know whether that's a design decision for HP VAN and I should do the aggregation manually in my module's Manager, or I am missing something to create these type of requests. 

Thank you!

Code I am using:

		MBodyMutableFlowStatsRequest flow_stats = new MBodyMutableFlowStatsRequest(PV);
		
		flow_stats.cookie(cookie)
			.cookieMask(cookieMask)
			.match((Match) MatchFactory.createMatch(PV).toImmutable());

		OfmMutableMultipartRequest req = 
    		(OfmMutableMultipartRequest) MessageFactory.create(PV, MessageType.MULTIPART_REQUEST);

//And one of the following lines
req.body((MultipartBody) flow_stats.toImmutable()); // Get an array back when cs.send req.type(MultipartType.AGGREGATE); // Eaises IllegalArg Exception "expected body(...) : AGGREGATE"
... MessageFuture future = cs.send(req.toImmutable(), dp); future.await(); // Blocks if (future.result().isSuccess()){ ....

 

 

2 REPLIES 2
ShaunWackerly
HPE Pro

Re: How to create a MULTIPART_REQUEST of type AGGREGATE?

Hi checho88,

Thank you for posting your sample code, it makes the issue much easier to diagnose. The quick answer is that the OFPMP_AGGREGATE message type is not something that is currently supported by the HPE VAN libraries. If it was supported, you'd use code like this:

OfmMutableMultipartRequest req = 
    		(OfmMutableMultipartRequest) MessageFactory.create(PV, MessageType.MULTIPART_REQUEST);
req.type(MultipartType.AGGREGATE);

MultipartBody body = MpBodyFactory.createRequestBody(PV, MultipartType.AGGREGATE);
// ... fill in body contents
req.body(body);

The MpBodyFactory.createRequestBody() method will throw a NotYetImplementedException to indicate that the specific multipart type (AGGREGATE) is not yet implemented. We do support all other multi-part types.

It sounds like this functionality is needed, so your only option would be to perform the aggregation in your module's manager. Are you wanting to use aggregation for coding convenience (ie: only gathering the data you need, nothing more), or do you think you'll need it for scaling efficiency (ie: gathering stats on thousands of flows)?

I am an HPE Employee
checho88
Occasional Contributor

Re: How to create a MULTIPART_REQUEST of type AGGREGATE?

Hi Shaun, thank you for your quick reply.

It is a pity that is not currently supported. I would say that right now we are okay doing the aggregation in the module since we are still in dev state and the amount of flows and switches in the network is small. However, once we migrate to production, the amount of switches and flows on campus will increase subtantially (hundreds or thousands) and I am unsure doing aggregation in the module will scale. The idea is to return these aggregate counters to (possibly multiple) monitoring service(s) that constantly poll(s) our module every certain amount of time (say every second).