2 * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
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
9 package org.opendaylight.openflowplugin.impl.datastore.multipart;
11 import org.opendaylight.openflowplugin.api.openflow.device.TxFacade;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsDataBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey;
21 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
23 public class TableFeaturesMultipartWriter extends AbstractMultipartWriter<TableFeatures> {
25 public TableFeaturesMultipartWriter(final TxFacade txFacade,
26 final InstanceIdentifier<Node> instanceIdentifier) {
27 super(txFacade, instanceIdentifier);
31 protected Class<TableFeatures> getType() {
32 return TableFeatures.class;
36 public void storeStatistics(final TableFeatures statistics, final boolean withParents) {
37 statistics.nonnullTableFeatures().values()
39 writeToTransaction(getInstanceIdentifier()
40 .augmentation(FlowCapableNode.class)
41 .child(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features
43 new TableFeaturesKey(stat.getTableId())),
47 // Write parent for table statistics
48 writeToTransaction(getInstanceIdentifier()
49 .augmentation(FlowCapableNode.class)
50 .child(Table.class, new TableKey(stat.getTableId())),
52 .setId(stat.getTableId())
53 .addAugmentation(FlowTableStatisticsData.class, new FlowTableStatisticsDataBuilder()