MD-SAL Statistics Manager - Changed Group/Meter Augmentataion location in operational...
[controller.git] / opendaylight / md-sal / statistics-manager / src / main / java / org / opendaylight / controller / md / statistics / manager / MultipartMessageManager.java
1 /*
2  * Copyright IBM Corporation, 2013.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.md.statistics.manager;
9
10 import java.util.Map;
11 import java.util.concurrent.ConcurrentHashMap;
12
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
14
15 /**
16  * Main responsibility of the class is to manage multipart response 
17  * for multipart request. It also handles the flow aggregate request
18  * and response mapping. 
19  * @author avishnoi@in.ibm.com
20  *
21  */
22 public class MultipartMessageManager {
23
24     /*
25      *  Map for tx id and type of request, to keep track of all the request sent 
26      *  by Statistics Manager. Statistics Manager won't entertain any multipart 
27      *  response for which it didn't send the request.  
28      */
29     
30     private static Map<TransactionId,StatsRequestType> txIdToRequestTypeMap = new ConcurrentHashMap<TransactionId,StatsRequestType>();
31     /*
32      * Map to keep track of the request tx id for flow table statistics request.
33      * Because flow table statistics multi part response do not contains the table id.
34      */
35     private static Map<TransactionId,Short> txIdTotableIdMap = new ConcurrentHashMap<TransactionId,Short>();
36     
37     public MultipartMessageManager(){}
38     
39     public Short getTableIdForTxId(TransactionId id){
40         
41         return txIdTotableIdMap.get(id);
42         
43     }
44     
45     public void setTxIdAndTableIdMapEntry(TransactionId id,Short tableId){
46         txIdTotableIdMap.put(id, tableId);
47     }
48     
49     public void addTxIdToRequestTypeEntry (TransactionId id,StatsRequestType type){
50         txIdToRequestTypeMap.put(id, type);
51     }
52     public StatsRequestType removeTxId(TransactionId id){
53         return txIdToRequestTypeMap.remove(id);
54     }
55     
56     public enum StatsRequestType{
57         ALL_FLOW,
58         AGGR_FLOW,
59         ALL_PORT,
60         ALL_FLOW_TABLE,
61         ALL_QUEUE_STATS,
62         ALL_GROUP,
63         ALL_METER,
64         GROUP_DESC,
65         METER_CONFIG
66     }
67 }