5c99ac27608e2424d457cfbb86612a893d0ebcb7
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / PCMMPdpDataProcess.java
1 /*
2  * (c) 2015 Cable Television Laboratories, Inc.  All rights reserved.
3  */
4
5 package org.pcmm;
6
7 import org.pcmm.gates.ITransactionID.GateCommandType;
8 import org.pcmm.gates.impl.PCMMGateReq;
9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory;
11 import org.umu.cops.COPSStateMan;
12 import org.umu.cops.prpdp.COPSPdpDataProcess;
13 import org.umu.cops.prpdp.COPSPdpReqStateMan;
14 import org.umu.cops.stack.COPSError;
15
16 import java.util.HashMap;
17 import java.util.Map;
18
19
20 public class PCMMPdpDataProcess implements COPSPdpDataProcess {
21
22     public final static Logger logger = LoggerFactory.getLogger(PCMMPdpDataProcess.class);
23
24     @Override
25     public Map getRemovePolicy(final COPSPdpReqStateMan man) {
26         logger.info("Retrieving the remove policy");
27         // TODO - Implement me
28         return new HashMap();
29     }
30
31     @Override
32     public Map getInstallPolicy(final COPSPdpReqStateMan man) {
33         logger.info("Retrieving the remove policy");
34         // TODO - Implement me
35         return new HashMap();
36     }
37
38     @Override
39     public void setClientData(final COPSPdpReqStateMan man, final Map<String, String> reqSIs) {
40         logger.info("Setting the client data");
41         // TODO - Implement me
42     }
43
44     /**
45      * Fail report received
46      * @param man - the state manager
47      * @param gateMsg - the gate request message
48      */
49     public void failReport(final COPSPdpReqStateMan man, final PCMMGateReq gateMsg) {
50         logger.info("Fail Report notified with error - " + gateMsg.getError().toString());
51         // TODO - Implement me
52     }
53
54     @Override
55     public void failReport(final COPSPdpReqStateMan man, final Map<String, String> reportSIs) {
56         logger.info("Fail report notified");
57         // TODO - Implement me
58     }
59
60     @Override
61     public void successReport(final COPSPdpReqStateMan man, final Map<String, String> reportSIs) {
62         logger.info("Success report notified");
63         // TODO - Implement me
64     }
65
66     /**
67      * Positive report received
68      * @param man - the state manager
69      * @param gateMsg - the gate request message
70      */
71     public void successReport(final COPSPdpReqStateMan man, final PCMMGateReq gateMsg) {
72         logger.info("Success Report notified.");
73
74         if ( gateMsg.getTransactionID().getGateCommandType().equals(GateCommandType.GATE_DELETE_ACK)) {
75             logger.info("GateDeleteAck: GateID = " + gateMsg.getGateID().getGateID());
76             if (gateMsg.getGateID().getGateID() == PCMMGlobalConfig.getGateID1())
77                 PCMMGlobalConfig.setGateID1(0);
78             if (gateMsg.getGateID().getGateID() == PCMMGlobalConfig.getGateID2())
79                 PCMMGlobalConfig.setGateID2(0);
80
81         }
82         if ( gateMsg.getTransactionID().getGateCommandType().equals(GateCommandType.GATE_SET_ACK)) {
83             logger.info("GateSetAck : GateID = " + gateMsg.getGateID().getGateID());
84             if (0 == PCMMGlobalConfig.getGateID1())
85                 PCMMGlobalConfig.setGateID1(gateMsg.getGateID().getGateID());
86             if (0 == PCMMGlobalConfig.getGateID2())
87                 PCMMGlobalConfig.setGateID2(gateMsg.getGateID().getGateID());
88         }
89     }
90
91     /**
92      * Accounting report received
93      * @param man - the state manager
94      * @param gateMsg - the gate request message
95      */
96     public void acctReport(final PCMMPdpReqStateMan man, final PCMMGateReq gateMsg) {
97         logger.info("Acct Report notified.");
98         // TODO - Impelement me
99     }
100
101     @Override
102     public void acctReport (final COPSPdpReqStateMan man, final Map reportSIs) {
103         logger.info("Acct Report notified.");
104         // TODO - had to implement but do not know what to do here
105     }
106
107     @Override
108     public void notifyNoAcctReport(final COPSPdpReqStateMan man) {
109         logger.info("No Acct Report notified.");
110         // TODO - Impelement me
111     }
112
113     @Override
114     public void notifyNoKAliveReceived(final COPSStateMan man) {
115         logger.info("Notify No K alive received.");
116         // TODO - Impelement me
117     }
118
119     @Override
120     public void notifyClosedConnection(final COPSStateMan man, final COPSError error) {
121         logger.info("Connection was closed by PEP");
122         // TODO - Implement me
123     }
124
125     @Override
126     public void notifyDeleteRequestState(final COPSPdpReqStateMan man) {
127         logger.info("Delete request state notified");
128         // TODO - Impelement me
129     }
130
131     @Override
132     public void closeRequestState(final COPSStateMan man) {
133         logger.info("Close request state notified");
134         // TODO - Impelement me
135     }
136 }