import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.netvirt.openstack.sfc.translator.flowclassifier.FlowClassifierTranslator;
+import org.opendaylight.netvirt.openstack.sfc.translator.portchain.PortChainTranslator;
+import org.opendaylight.netvirt.openstack.sfc.translator.portchain.PortPairGroupTranslator;
+import org.opendaylight.netvirt.openstack.sfc.translator.portchain.PortPairTranslator;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.openstack.sfc.translator.config.rev160720.OpenstackSfcTranslatorConfig;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
private final DataBroker dataBroker;
private final BundleContext bundleContext;
private final FlowClassifierTranslator flowClassifierTranslator;
+ private final PortPairTranslator portPairTranslator;
+ private final PortPairGroupTranslator portPairGroupTranslator;
+ private final PortChainTranslator portChainTranslator;
public OpenStackSFCTranslatorProvider(
final DataBroker dataBroker,
final OpenstackSfcTranslatorConfig openstackSfcTranslatorConfig,
final BundleContext bundleContext) {
- LOG.info("OpenStack SFC Translator started");
this.dataBroker = dataBroker;
this.bundleContext = bundleContext;
flowClassifierTranslator = new FlowClassifierTranslator(dataBroker);
+ portPairTranslator = new PortPairTranslator(dataBroker);
+ portPairGroupTranslator = new PortPairGroupTranslator(dataBroker);
+ portChainTranslator = new PortChainTranslator(dataBroker);
}
//This method will be called by blueprint, during bundle initialization.
public void start() {
- LOG.info("OpenStack SFC Translator Session Initiated");
+ LOG.info("OpenStack SFC Translator Session started");
flowClassifierTranslator.start();
+ portPairTranslator.start();
+ portPairGroupTranslator.start();
+ portChainTranslator.start();
}
@Override
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netvirt.openstack.sfc.translator.portchain;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.netvirt.openstack.sfc.translator.DelegatingDataTreeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.PortChains;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.chains.PortChain;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * OpenDaylight Neutron Port Chain yang models data change listener
+ */
+public class NeutronPortChainListener extends DelegatingDataTreeListener<PortChain> {
+ private static final InstanceIdentifier<PortChain> portChainIid =
+ InstanceIdentifier.create(Neutron.class).child(PortChains.class).child(PortChain.class);
+
+ public NeutronPortChainListener(DataBroker db, PortChainTranslator portChainTranslator) {
+ super(portChainTranslator, db,
+ new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, portChainIid));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netvirt.openstack.sfc.translator.portchain;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.netvirt.openstack.sfc.translator.DelegatingDataTreeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.PortPairGroups;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pair.groups.PortPairGroup;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * OpenDaylight Neutron Port Group yang models data change listener
+ */
+public class NeutronPortPairGroupListener extends DelegatingDataTreeListener<PortPairGroup> {
+ private static final InstanceIdentifier<PortPairGroup> portPairGroupIid =
+ InstanceIdentifier.create(Neutron.class).child(PortPairGroups.class).child(PortPairGroup.class);
+
+ public NeutronPortPairGroupListener(DataBroker db, PortPairGroupTranslator portPairGroupTranslator) {
+ super(portPairGroupTranslator, db,
+ new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, portPairGroupIid));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netvirt.openstack.sfc.translator.portchain;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.netvirt.openstack.sfc.translator.DelegatingDataTreeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.PortPairs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pairs.PortPair;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * OpenDaylight Neutron Port Pair yang models data change listener
+ */
+public class NeutronPortPairListener extends DelegatingDataTreeListener<PortPair> {
+ private static final InstanceIdentifier<PortPair> portPairIid =
+ InstanceIdentifier.create(Neutron.class).child(PortPairs.class).child(PortPair.class);
+
+ public NeutronPortPairListener(DataBroker db, PortPairTranslator portPairTranslator) {
+ super(portPairTranslator, db,
+ new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, portPairIid));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netvirt.openstack.sfc.translator.portchain;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.netvirt.openstack.sfc.translator.INeutronSfcDataProcessor;
+import org.opendaylight.netvirt.openstack.sfc.translator.NeutronMdsalHelper;
+import org.opendaylight.netvirt.openstack.sfc.translator.SfcMdsalHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.chains.PortChain;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class will convert OpenStack Port Chain API yang models present in
+ * neutron northbound project to OpenDaylight SFC yang models.
+ */
+public class PortChainTranslator implements INeutronSfcDataProcessor<PortChain> {
+ private static final Logger LOG = LoggerFactory.getLogger(PortChainTranslator.class);
+
+ private final DataBroker db;
+ private NeutronPortChainListener neutronPortChainListener;
+ private final SfcMdsalHelper sfcMdsalHelper;
+ private final NeutronMdsalHelper neutronMdsalHelper;
+
+ public PortChainTranslator(DataBroker db) {
+ this.db = db;
+ sfcMdsalHelper = new SfcMdsalHelper(db);
+ neutronMdsalHelper = new NeutronMdsalHelper(db);
+ }
+
+ public void start() {
+ LOG.info("Port Chain Translator Initialized.");
+ if(neutronPortChainListener == null) {
+ neutronPortChainListener = new NeutronPortChainListener(db, this);
+ }
+ }
+
+ /**
+ * Method removes PortChain which is identified by InstanceIdentifier.
+ *
+ * @param path - the whole path to PortChain
+ * @param deletedPortChain - PortChain for removing
+ */
+ @Override
+ public void remove(InstanceIdentifier<PortChain> path, PortChain deletedPortChain) {
+
+ }
+
+ /**
+ * Method updates the original PortChain to the update PortChain.
+ * Both are identified by same InstanceIdentifier.
+ *
+ * @param path - the whole path to PortChain
+ * @param originalPortChain - original PortChain (for update)
+ * @param updatePortChain - changed PortChain (contain updates)
+ */
+ @Override
+ public void update(InstanceIdentifier<PortChain> path, PortChain originalPortChain, PortChain updatePortChain) {
+
+ }
+
+ /**
+ * Method adds the PortChain which is identified by InstanceIdentifier
+ * to device.
+ *
+ * @param path - the whole path to new PortChain
+ * @param newPortChain - new PortChain
+ */
+ @Override
+ public void add(InstanceIdentifier<PortChain> path, PortChain newPortChain) {
+
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netvirt.openstack.sfc.translator.portchain;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.netvirt.openstack.sfc.translator.INeutronSfcDataProcessor;
+import org.opendaylight.netvirt.openstack.sfc.translator.NeutronMdsalHelper;
+import org.opendaylight.netvirt.openstack.sfc.translator.SfcMdsalHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pair.groups.PortPairGroup;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class will convert OpenStack Port Pair API yang models present in
+ * neutron northbound project to OpenDaylight SFC yang models.
+ */
+public class PortPairGroupTranslator implements INeutronSfcDataProcessor<PortPairGroup> {
+ private static final Logger LOG = LoggerFactory.getLogger(PortPairGroupTranslator.class);
+
+ private final DataBroker db;
+ private NeutronPortPairGroupListener neutronPortPairGroupListener;
+ private final SfcMdsalHelper sfcMdsalHelper;
+ private final NeutronMdsalHelper neutronMdsalHelper;
+
+ public PortPairGroupTranslator(DataBroker db) {
+ this.db = db;
+ sfcMdsalHelper = new SfcMdsalHelper(db);
+ neutronMdsalHelper = new NeutronMdsalHelper(db);
+ }
+
+ public void start() {
+ LOG.info("Port Pair Group Translator Initialized.");
+ if(neutronPortPairGroupListener == null) {
+ neutronPortPairGroupListener = new NeutronPortPairGroupListener(db, this);
+ }
+ }
+
+ /**
+ * Method removes PortPairGroup which is identified by InstanceIdentifier.
+ *
+ * @param path - the whole path to PortPairGroup
+ * @param deletedPortPairGroup - PortPairGroup for removing
+ */
+ @Override
+ public void remove(InstanceIdentifier<PortPairGroup> path, PortPairGroup deletedPortPairGroup) {
+
+ }
+
+ /**
+ * Method updates the original PortPairGroup to the update PortPairGroup.
+ * Both are identified by same InstanceIdentifier.
+ *
+ * @param path - the whole path to PortPairGroup
+ * @param originalPortPairGroup - original PortPairGroup (for update)
+ * @param updatePortPairGroup - changed PortPairGroup (contain updates)
+ */
+ @Override
+ public void update(InstanceIdentifier<PortPairGroup> path,
+ PortPairGroup originalPortPairGroup,
+ PortPairGroup updatePortPairGroup) {
+
+ }
+
+ /**
+ * Method adds the PortPairGroup which is identified by InstanceIdentifier
+ * to device.
+ *
+ * @param path - the whole path to new PortPairGroup
+ * @param newPortPairGroup - new PortPairGroup
+ */
+ @Override
+ public void add(InstanceIdentifier<PortPairGroup> path, PortPairGroup newPortPairGroup) {
+
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netvirt.openstack.sfc.translator.portchain;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.netvirt.openstack.sfc.translator.INeutronSfcDataProcessor;
+import org.opendaylight.netvirt.openstack.sfc.translator.NeutronMdsalHelper;
+import org.opendaylight.netvirt.openstack.sfc.translator.SfcMdsalHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pairs.PortPair;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class will convert OpenStack Port Pair API yang models present in
+ * neutron northbound project to OpenDaylight SFC yang models.
+ */
+public class PortPairTranslator implements INeutronSfcDataProcessor<PortPair> {
+ private static final Logger LOG = LoggerFactory.getLogger(PortPairTranslator.class);
+
+ private final DataBroker db;
+ private NeutronPortPairListener neutronPortPairListener;
+ private final SfcMdsalHelper sfcMdsalHelper;
+ private final NeutronMdsalHelper neutronMdsalHelper;
+
+ public PortPairTranslator(DataBroker db) {
+ this.db = db;
+ sfcMdsalHelper = new SfcMdsalHelper(db);
+ neutronMdsalHelper = new NeutronMdsalHelper(db);
+ }
+
+ public void start() {
+ LOG.info("Port Pair Translator Initialized.");
+ if(neutronPortPairListener == null) {
+ neutronPortPairListener = new NeutronPortPairListener(db, this);
+ }
+ }
+
+ /**
+ * Method removes PortPair which is identified by InstanceIdentifier.
+ *
+ * @param path - the whole path to PortPair
+ * @param deletedPortPair - PortPair for removing
+ */
+ @Override
+ public void remove(InstanceIdentifier<PortPair> path, PortPair deletedPortPair) {
+
+ }
+
+ /**
+ * Method updates the original PortPair to the update PortPair.
+ * Both are identified by same InstanceIdentifier.
+ *
+ * @param path - the whole path to PortPair
+ * @param originalPortPair - original PortPair (for update)
+ * @param updatePortPair - changed PortPair (contain updates)
+ */
+ @Override
+ public void update(InstanceIdentifier<PortPair> path, PortPair originalPortPair, PortPair updatePortPair) {
+
+ }
+
+ /**
+ * Method adds the PortPair which is identified by InstanceIdentifier
+ * to device.
+ *
+ * @param path - the whole path to new PortPair
+ * @param newPortPair - new PortPair
+ */
+ @Override
+ public void add(InstanceIdentifier<PortPair> path, PortPair newPortPair) {
+
+ }
+}