2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.honeycomb.v3po.translate.v3po.initializers;
19 import io.fd.honeycomb.v3po.vpp.data.init.AbstractDataTreeConverter;
20 import java.util.stream.Collectors;
21 import javax.annotation.Nonnull;
22 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppClassifier;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppClassifierBuilder;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableBuilder;
26 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
29 * Initializes vpp-classfier node in config data tree based on operational state.
31 public class VppClasifierInitializer extends AbstractDataTreeConverter<VppClassifier, VppClassifier> {
32 private static final InstanceIdentifier<VppClassifier> ID = InstanceIdentifier.create(VppClassifier.class);
34 public VppClasifierInitializer(@Nonnull final DataBroker bindingDataBroker) {
35 super(bindingDataBroker, ID, ID);
39 protected VppClassifier convert(final VppClassifier operationalData) {
40 final VppClassifierBuilder builder = new VppClassifierBuilder();
41 builder.setClassifyTable(operationalData.getClassifyTable().stream()
42 .map(oper -> new ClassifyTableBuilder(oper).setActiveSessions(null).build())
43 .collect(Collectors.toList()));
44 return builder.build();