+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2014 Red Hat, 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
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>commons</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../commons/parent</relativePath>
- </parent>
-
- <artifactId>plugin-mdsal-adapter</artifactId>
- <version>1.2.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.dependencymanager</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <!-- Yang Models -->
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>concepts</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>yang-binding</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-inventory</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.openflowplugin.model</groupId>
- <artifactId>model-flow-service</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>yang-ext</artifactId>
- </dependency>
- <!-- Controller Dependencies -->
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>library</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>plugin</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>schema.openvswitch</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.4.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-Package>
- org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.*,
- org.opendaylight.controller.sal.binding.api,
- org.opendaylight.ovsdb.plugin.api,
- org.apache.felix.dm,
- org.slf4j,
- org.eclipse.osgi.framework.console,
- org.osgi.framework,
- javax.net.ssl,
- *
- </Import-Package>
- <Embed-Transitive>true</Embed-Transitive>
- <Bundle-Activator>
- org.opendaylight.ovsdb.plugin.md.Activator
- </Bundle-Activator>
- </instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2013, 2015 Red Hat, 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.ovsdb.plugin.md;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
-import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
-import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
-
-import org.apache.felix.dm.Component;
-
-/**
- * OSGi Bundle Activator for the Neutron providers
- */
-public class Activator extends ComponentActivatorAbstractBase {
- /**
- * Function called when the activator starts just after some
- * initializations are done by the
- * ComponentActivatorAbstractBase.
- */
- @Override
- public void init() {
- }
-
- /**
- * Function called when the activator stops just before the
- * cleanup done by ComponentActivatorAbstractBase.
- *
- */
- @Override
- public void destroy() {
- }
-
- /**
- * Function that is used to communicate to dependency manager the
- * list of known implementations for services inside a container.
- *
- * @return An array containing all the CLASS objects that will be
- * instantiated in order to get an fully working implementation
- * Object
- */
- @Override
- public Object[] getImplementations() {
- Object[] res = {OvsdbBindingAwareProviderImpl.class,
- OvsdbInventoryManager.class };
- return res;
- }
-
- /**
- * Function that is called when configuration of the dependencies
- * is required.
- *
- * @param c dependency manager Component object, used for
- * configuring the dependencies exported and imported
- * @param imp Implementation class that is being configured,
- * needed as long as the same routine can configure multiple
- * implementations
- * @param containerName The containerName being configured, this allow
- * also optional per-container different behavior if needed, usually
- * should not be the case though.
- */
- @Override
- public void configureInstance(Component c, Object imp,
- String containerName) {
-
- if (imp.equals(OvsdbBindingAwareProviderImpl.class)) {
- c.setInterface(OvsdbBindingAwareProvider.class.getName(), null);
- c.add(createServiceDependency()
- .setService(BindingAwareBroker.class)
- .setRequired(true));
- }
-
- if (imp.equals(OvsdbInventoryManager.class)) {
- c.setInterface(OvsdbInventoryListener.class.getName(), null);
- c.add(createServiceDependency()
- .setService(OvsdbBindingAwareProvider.class)
- .setRequired(true));
- c.add(createServiceDependency()
- .setService(OvsdbConfigurationService.class)
- .setRequired(true));
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013, 2015 Red Hat, 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.ovsdb.plugin.md;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.NotificationService;
-
-/**
- * Created by dave on 01/08/2014.
- */
-public interface OvsdbBindingAwareProvider {
- public DataBroker getDataBroker();
- public NotificationService getNotificationService();
-}
+++ /dev/null
-/*
- * Copyright (c) 2013, 2015 Red Hat, 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.ovsdb.plugin.md;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.binding.api.NotificationService;
-
-import org.apache.felix.dm.Component;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class OvsdbBindingAwareProviderImpl extends AbstractBindingAwareProvider implements OvsdbBindingAwareProvider {
-
- private DataBroker dataBroker;
- private NotificationProviderService notificationService;
-
- static final Logger logger = LoggerFactory.getLogger(OvsdbBindingAwareProvider.class);
-
- private BundleContext bc;
- private volatile BindingAwareBroker broker;
-
- void init(Component c) {
- this.bc = c.getDependencyManager().getBundleContext();
- broker.registerProvider(this, this.bc);
- logger.info("OVSDB MD-SAL Inventory Adapter Registered With the MD-SAL");
- }
-
- void destroy() {
- this.dataBroker = null;
- this.notificationService = null;
- }
-
- @Override
- public void onSessionInitiated(BindingAwareBroker.ProviderContext providerContext) {
- this.dataBroker = providerContext.getSALService(DataBroker.class);
- this.notificationService = providerContext.getSALService(NotificationProviderService.class);
- }
-
- @Override
- public DataBroker getDataBroker() {
- return this.dataBroker;
- }
-
- @Override
- public NotificationService getNotificationService() {
- return this.notificationService;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013, 2015 Red Hat, 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.ovsdb.plugin.md;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.utils.HexEncode;
-import org.opendaylight.ovsdb.lib.notation.Row;
-import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
-import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
-import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.ovsdb.node.inventory.rev140731.OvsdbCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.ovsdb.node.inventory.rev140731.OvsdbCapableNodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.ovsdb.node.inventory.rev140731.OvsdbManagedNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.ovsdb.node.inventory.rev140731.OvsdbManagedNodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.ovsdb.node.inventory.rev140731.nodes.node.OvsdbBridge;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.ovsdb.node.inventory.rev140731.nodes.node.OvsdbBridgeBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-
-/**
- * Handle OVSDB Inventory Updates and create the necessary entries in the MD-SAL config datastore
- */
-public class OvsdbInventoryManager implements OvsdbInventoryListener {
-
- // Dependencies injected by OSGi
- private volatile OvsdbBindingAwareProvider provider;
- private volatile OvsdbConfigurationService ovsdbConfigurationService;
-
- static final String OVS_NODE_PREFIX = "openvswitch:";
- static final String OPENFLOW_NODE_PREFIX = "openflow:";
-
- static final Logger LOGGER = LoggerFactory.getLogger(OvsdbInventoryManager.class);
-
-
- /**
- * Called by the framework when the bundle is started
- */
- public void start() {
- //ToDo: Add existing nodes from inventory
- //This case is required for surviving controller reboot
- }
-
- /**
- * When an AD-SAL node is added by the OVSDB Inventory Service, Add an MD-SAL node
- *
- * @param node The AD-SAL node
- * @param address The {@link java.net.InetAddress} of the Node
- * @param port The ephemeral port number used by this connection
- */
- @Override
- public synchronized void nodeAdded(org.opendaylight.controller.sal.core.Node node,
- InetAddress address,
- int port) {
- DataBroker dataBroker = provider.getDataBroker();
- Preconditions.checkNotNull(dataBroker);
-
- NodeId nodeId = new NodeId(OVS_NODE_PREFIX + node.getNodeIDString());
- NodeKey nodeKey = new NodeKey(nodeId);
-
- OvsdbCapableNode ovsdbNode = new OvsdbCapableNodeBuilder()
- .setIpAddress(Utils.convertIpAddress(address))
- .setPort(new PortNumber(port))
- .setManagedNodes(new ArrayList<NodeId>())
- .build();
-
- Node newNode = new NodeBuilder()
- .setId(nodeId)
- .setKey(nodeKey)
- .addAugmentation(OvsdbCapableNode.class, ovsdbNode)
- .build();
-
- InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, nodeKey)
- .toInstance();
-
- WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
- tx.put(LogicalDatastoreType.CONFIGURATION, path, newNode, true);
- try {
- tx.submit().get();
- LOGGER.debug("Removed Node {}", path.toString());
- } catch (InterruptedException | ExecutionException e) {
- LOGGER.error(e.getMessage(), e);
- }
- }
-
- /**
- * When an AD-SAL node is removed by the OVSDB Inventory Service, Remove the MD-SAL node
- *
- * @param node The AD-SAL node
- */
- @Override
- public synchronized void nodeRemoved(org.opendaylight.controller.sal.core.Node node) {
- DataBroker dataBroker = provider.getDataBroker();
- Preconditions.checkNotNull(dataBroker);
-
- NodeId nodeId = new NodeId(new NodeId(OVS_NODE_PREFIX + node.getNodeIDString()));
- NodeKey nodeKey = new NodeKey(nodeId);
-
- InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, nodeKey)
- .toInstance();
-
- WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
- tx.delete(LogicalDatastoreType.CONFIGURATION, path);
- try {
- tx.submit().get();
- LOGGER.debug("Removed Node {}", path.toString());
- } catch (InterruptedException | ExecutionException e) {
- LOGGER.error(e.getMessage(), e);
- }
- }
-
- /**
- * Handle OVSDB row removed When a Bridge row is removed, the OpenFlow Node is deleted The parent OVSDB node is
- * updated and the OpenFlow node removed from it's managed-nodes list
- *
- * @param node The AD-SAL node
- * @param tableName The name of modified table
- * @param uuid The UUID of the deleted row
- * @param row The deleted Row
- */
- @Override
- public synchronized void rowRemoved(org.opendaylight.controller.sal.core.Node node,
- String tableName,
- String uuid,
- Row row,
- Object context) {
- if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Bridge.class))) {
- LOGGER.debug("OVSDB Bridge Row removed on node {}", node.toString());
- DataBroker dataBroker = provider.getDataBroker();
- Preconditions.checkNotNull(dataBroker);
-
- Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
- Set<String> dpidString = bridge.getDatapathIdColumn().getData();
- Long dpid = HexEncode.stringToLong((String) dpidString.toArray()[0]);
-
- NodeId openflowNodeId = new NodeId(OPENFLOW_NODE_PREFIX + dpid.toString());
- NodeKey openflowNodeKey = new NodeKey(openflowNodeId);
-
- InstanceIdentifier<Node> openflowNodePath = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, openflowNodeKey)
- .toInstance();
-
- NodeId ovsdbNodeId = new NodeId(OVS_NODE_PREFIX + node.getNodeIDString());
- NodeKey ovsdbNodeKey = new NodeKey(ovsdbNodeId);
-
- InstanceIdentifier<OvsdbCapableNode> ovsdbNodePath = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, ovsdbNodeKey)
- .augmentation(OvsdbCapableNode.class)
- .toInstance();
-
- // Read the current OVSDB Node from the DataStore
- ReadWriteTransaction tx = dataBroker.newReadWriteTransaction();
- OvsdbCapableNode ovsdbNode;
- try {
- Optional<OvsdbCapableNode> data = tx.read(LogicalDatastoreType.CONFIGURATION, ovsdbNodePath).get();
- if (!data.isPresent()) {
- LOGGER.error("OVSDB node not updated. Parent node for {} does not exist", ovsdbNodePath.toString());
- return;
- }
- ovsdbNode = data.get();
- } catch (InterruptedException | ExecutionException e) {
- LOGGER.error("OVSDB node not updated. Parent node for {} does not exist", ovsdbNodePath.toString());
- return;
- }
-
- // Update the list of Nodes
- List<NodeId> managedNodesList = ovsdbNode.getManagedNodes();
- managedNodesList.remove(openflowNodeId);
-
- // Write changes to DataStore
- OvsdbCapableNode updatedNode = new OvsdbCapableNodeBuilder(ovsdbNode)
- .setManagedNodes(managedNodesList)
- .build();
- tx.delete(LogicalDatastoreType.CONFIGURATION, openflowNodePath);
- tx.put(LogicalDatastoreType.CONFIGURATION, ovsdbNodePath, updatedNode);
-
- try {
- tx.submit().get();
- LOGGER.debug("Transaction success for delete of {} and update of {}",
- openflowNodePath.toString(),
- ovsdbNodePath.toString());
- } catch (InterruptedException | ExecutionException e) {
- LOGGER.error(e.getMessage(), e);
- }
- }
- }
-
- /**
- * Handle OVSDB row updates When a Bridge row is updated and it contains a DPID then add a new OpenFlow node to the
- * inventory A relationship is created between the OpenFlow and OVSDB nodes
- *
- * @param node The AD-SAL node
- * @param tableName The name of the updated table
- * @param uuid The UUID of the updated row
- * @param old The old contents of the row
- * @param row The updated Row
- */
- @Override
- public synchronized void rowUpdated(org.opendaylight.controller.sal.core.Node node,
- String tableName,
- String uuid,
- Row old,
- Row row) {
- LOGGER.debug("OVSDB Bridge Row updated on node {}", node.toString());
- if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Bridge.class))) {
- DataBroker dataBroker = provider.getDataBroker();
- Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
-
- Set<String> dpidString = bridge.getDatapathIdColumn().getData();
- Long dpid;
- try {
- dpid = HexEncode.stringToLong((String) dpidString.toArray()[0]);
- } catch (ArrayIndexOutOfBoundsException e) {
- return;
- }
-
- NodeId openflowNodeId = new NodeId(OPENFLOW_NODE_PREFIX + dpid.toString());
- NodeKey openflowNodeKey = new NodeKey(openflowNodeId);
-
- InstanceIdentifier<OvsdbManagedNode> openflowNodepath = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, openflowNodeKey)
- .augmentation(OvsdbManagedNode.class)
- .toInstance();
-
- NodeId ovsdbNodeId = new NodeId(OVS_NODE_PREFIX + node.getNodeIDString());
- NodeKey ovsdbNodeKey = new NodeKey(ovsdbNodeId);
-
- InstanceIdentifier<OvsdbCapableNode> ovsdbNodePath = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, ovsdbNodeKey)
- .augmentation(OvsdbCapableNode.class)
- .toInstance();
-
- // Create an OvsdbBridge object using the information from the update
- OvsdbBridge ovsdbBridge = new OvsdbBridgeBuilder()
- .setBridgeName(bridge.getName())
- .setBridgeUuid(uuid)
- .setManagedBy(ovsdbNodeId)
- .build();
-
- // Add the bridge to the OvsdbManagedNode
- OvsdbManagedNode ovsdbManagedNode = new OvsdbManagedNodeBuilder()
- .setOvsdbBridge(ovsdbBridge)
- .build();
-
- // Read the current OVSDB Node from the DataStore
- ReadWriteTransaction tx = dataBroker.newReadWriteTransaction();
- OvsdbCapableNode ovsdbNode;
- try {
- Optional<OvsdbCapableNode> data = tx.read(LogicalDatastoreType.CONFIGURATION, ovsdbNodePath).get();
- if (!data.isPresent()) {
- LOGGER.error("OVSDB node not updated. Parent node for {} does not exist", ovsdbNodePath.toString());
- return;
- }
- ovsdbNode = data.get();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException("Node does not exist");
- }
-
- // Update the list of Nodes
- List<NodeId> managedNodesList = ovsdbNode.getManagedNodes();
- managedNodesList.add(openflowNodeId);
-
- // Create a delta object
- OvsdbCapableNode updatedNode = new OvsdbCapableNodeBuilder(ovsdbNode)
- .setManagedNodes(managedNodesList)
- .build();
-
- // Create parent if we get to this node before openflowplugin
- tx.put(LogicalDatastoreType.CONFIGURATION, openflowNodepath, ovsdbManagedNode, true);
- tx.put(LogicalDatastoreType.CONFIGURATION, ovsdbNodePath, updatedNode);
-
- try {
- tx.submit().get();
- LOGGER.debug("Transaction success for addition of {} and update of {}",
- openflowNodepath.toString(),
- ovsdbNodePath.toString());
- } catch (InterruptedException | ExecutionException e) {
- LOGGER.error(e.getMessage(), e);
- }
- }
- }
-
- @Override
- public synchronized void rowAdded(org.opendaylight.controller.sal.core.Node node,
- String tableName,
- String uuid,
- Row row) {
- // noop
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013, 2015 Red Hat, 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.ovsdb.plugin.md;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.Inet4Address;
-import java.net.InetAddress;
-
-/**
- * Utilities to convert Java types to the types specified in the Yang models
- */
-public final class Utils {
-
- static final Logger logger = LoggerFactory.getLogger(Utils.class);
-
- /**
- * Returns a {@link org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress}
- * from a @{link java.net.InetAddress}
- */
- public static IpAddress convertIpAddress(InetAddress inetAddress){
-
- if (inetAddress instanceof Inet4Address){
- Ipv4Address ipv4Address = new Ipv4Address(inetAddress.getHostAddress());
- return new IpAddress(ipv4Address);
- }
- else {
- Ipv6Address ipv6Address = new Ipv6Address(inetAddress.getHostAddress());
- return new IpAddress(ipv6Address);
- }
- }
-}
+++ /dev/null
-module ovsdb-node-inventory {
- namespace "urn:opendaylight:ovsdb-node-inventory";
- prefix "ovsdbinv";
-
- import opendaylight-inventory {
- prefix inv;
- revision-date "2013-08-19";
- }
-
- import yang-ext {
- prefix ext;
- revision-date "2013-07-09";
- }
-
- import ietf-inet-types {
- prefix inet;
- revision-date "2010-09-24";
- }
-
- import flow-node-inventory {
- prefix flowcapable;
- revision-date "2013-08-19";
- }
-
- revision "2014-07-31" {
- description "Initial revision of the OVSDB Inventory model";
- }
-
- grouping ovsdb-bridge-attributes {
- leaf bridge-uuid {
- description "The unique identifier of the bridge";
- type string;
- }
-
- leaf bridge-name {
- description "The name of the bridge";
- type string;
- }
-
- leaf managed-by {
- description "The OVSDB which this bridge belongs to";
- type inv:node-id;
- }
- }
-
- grouping ovsdb-node-attributes {
- leaf ip-address {
- description "The IP Address of an OVSDB node";
- type inet:ip-address;
- }
-
- leaf port {
- description "The port that an OVSDB node is connected on";
- type inet:port-number;
- }
-
- leaf-list managed-nodes {
- type inv:node-id;
- }
- }
-
- augment /inv:nodes/inv:node {
- ext:augment-identifier "ovsdb-managed-node";
- // when "/inv:nodes/inv:node/flowcapable:manufacturer = '*'";
- container ovsdb-bridge {
- uses ovsdb-bridge-attributes;
- }
- }
-
- augment /inv:nodes/inv:node {
- ext:augment-identifier "ovsdb-capable-node";
- uses ovsdb-node-attributes;
- }
-
-}
+++ /dev/null
-package org.opendaylight.ovsdb.plugin.md;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public class UtilsTest {
-
- static final String IPV4_ADDRESS = "10.10.10.10";
- static final String IPV6_ADDRESS = "2001:db8:0:0:0:ff00:42:8329";
-
- @Test
- public void testConvertIpAddress() throws UnknownHostException {
-
- InetAddress addressV4 = Inet4Address.getByName(IPV4_ADDRESS);
- InetAddress addressV6 = Inet6Address.getByName(IPV6_ADDRESS);
-
- IpAddress ipAddresV4 = Utils.convertIpAddress(addressV4);
- IpAddress ipAddresV6 = Utils.convertIpAddress(addressV6);
-
- Assert.assertEquals(IPV4_ADDRESS, ipAddresV4.getIpv4Address().getValue());
- Assert.assertEquals(IPV6_ADDRESS, ipAddresV6.getIpv6Address().getValue());
- }
-}
\ No newline at end of file