Remove unused parameters
[netvirt.git] / sfc / translator / src / main / java / org / opendaylight / netvirt / sfc / translator / flowclassifier / NeutronFlowClassifierListener.java
1 /*
2  * Copyright (c) 2016, 2017 Brocade Communications Systems, Inc. and others.  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
9 package org.opendaylight.netvirt.sfc.translator.flowclassifier;
10
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
13 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
14 import org.opendaylight.netvirt.sfc.translator.DelegatingDataTreeListener;
15 import org.opendaylight.netvirt.sfc.translator.SfcMdsalHelper;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.flow.classifier.rev160511.sfc.flow.classifiers.attributes.SfcFlowClassifiers;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.flow.classifier.rev160511.sfc.flow.classifiers.attributes.sfc.flow.classifiers.SfcFlowClassifier;
20 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
21
22 /**
23  * OpenDaylight Neutron Flow Classifier yang models data change listener.
24  */
25 public class NeutronFlowClassifierListener extends DelegatingDataTreeListener<SfcFlowClassifier> {
26
27     private static final InstanceIdentifier<SfcFlowClassifier> FLOW_CLASSIFIERS_IID =
28             InstanceIdentifier.create(Neutron.class).child(SfcFlowClassifiers.class).child(SfcFlowClassifier.class);
29
30     private final SfcMdsalHelper sfcMdsalHelper;
31
32     public NeutronFlowClassifierListener(DataBroker db) {
33         super(db, new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, FLOW_CLASSIFIERS_IID));
34         sfcMdsalHelper = new SfcMdsalHelper(db);
35
36     }
37
38     /**
39      * Method removes Acl respective to SfcFlowClassifier which is identified by InstanceIdentifier.
40      *
41      * @param deletedSfcFlowClassifier        - SfcFlowClassifier for removing
42      */
43     @Override
44     public void remove(SfcFlowClassifier deletedSfcFlowClassifier) {
45         Acl aclFlowClassifier = FlowClassifierTranslator.buildAcl(deletedSfcFlowClassifier);
46         sfcMdsalHelper.removeAclFlowClassifier(aclFlowClassifier);
47     }
48
49     /**
50      * Method updates the original SfcFlowClassifier to the update SfcFlowClassifier.
51      * Both are identified by same InstanceIdentifier.
52      *
53      * @param updatedSfcFlowClassifier     - changed SfcFlowClassifier (contain updates)
54      */
55     @Override
56     public void update(SfcFlowClassifier updatedSfcFlowClassifier) {
57
58         Acl aclFlowClassifier = FlowClassifierTranslator.buildAcl(updatedSfcFlowClassifier);
59         sfcMdsalHelper.updateAclFlowClassifier(aclFlowClassifier);
60     }
61
62     /**
63      * Method adds the SfcFlowClassifier which is identified by InstanceIdentifier
64      * to device.
65      *
66      * @param sfcFlowClassifier        - new SfcFlowClassifier
67      */
68     @Override
69     public void add(SfcFlowClassifier sfcFlowClassifier) {
70         // Respective ACL classifier will be written in data store, once the chain is created.
71     }
72
73 }