2 * Copyright (c) 2016 Brocade Communications Systems, Inc. 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
8 package org.opendaylight.netvirt.openstack.sfc.translator.portchain;
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.netvirt.openstack.sfc.translator.INeutronSfcDataProcessor;
12 import org.opendaylight.netvirt.openstack.sfc.translator.NeutronMdsalHelper;
13 import org.opendaylight.netvirt.openstack.sfc.translator.SfcMdsalHelper;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pair.groups.PortPairGroup;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * Class will convert OpenStack Port Pair API yang models present in
21 * neutron northbound project to OpenDaylight SFC yang models.
23 public class PortPairGroupTranslator implements INeutronSfcDataProcessor<PortPairGroup> {
24 private static final Logger LOG = LoggerFactory.getLogger(PortPairGroupTranslator.class);
26 private final DataBroker db;
27 private NeutronPortPairGroupListener neutronPortPairGroupListener;
28 private final SfcMdsalHelper sfcMdsalHelper;
29 private final NeutronMdsalHelper neutronMdsalHelper;
31 public PortPairGroupTranslator(DataBroker db) {
33 sfcMdsalHelper = new SfcMdsalHelper(db);
34 neutronMdsalHelper = new NeutronMdsalHelper(db);
38 LOG.info("Port Pair Group Translator Initialized.");
39 if(neutronPortPairGroupListener == null) {
40 neutronPortPairGroupListener = new NeutronPortPairGroupListener(db, this);
45 * Method removes PortPairGroup which is identified by InstanceIdentifier.
47 * @param path - the whole path to PortPairGroup
48 * @param deletedPortPairGroup - PortPairGroup for removing
51 public void remove(InstanceIdentifier<PortPairGroup> path, PortPairGroup deletedPortPairGroup) {
56 * Method updates the original PortPairGroup to the update PortPairGroup.
57 * Both are identified by same InstanceIdentifier.
59 * @param path - the whole path to PortPairGroup
60 * @param originalPortPairGroup - original PortPairGroup (for update)
61 * @param updatePortPairGroup - changed PortPairGroup (contain updates)
64 public void update(InstanceIdentifier<PortPairGroup> path,
65 PortPairGroup originalPortPairGroup,
66 PortPairGroup updatePortPairGroup) {
71 * Method adds the PortPairGroup which is identified by InstanceIdentifier
74 * @param path - the whole path to new PortPairGroup
75 * @param newPortPairGroup - new PortPairGroup
78 public void add(InstanceIdentifier<PortPairGroup> path, PortPairGroup newPortPairGroup) {