<name>OpenDaylight :: Openflow Plugin :: Nicira Extensions</name>
+ <dependencyManagement>
+ <dependencies>
+ <!-- This project -->
+ <dependency>
+ <groupId>org.opendaylight.openflowplugin</groupId>
+ <artifactId>openflowplugin-artifacts</artifactId>
+ <version>${project.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<!-- feature dependencies -->
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>odl-openflowplugin-southbound</artifactId>
- <version>${project.version}</version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
-
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowjava-extension-nicira-api</artifactId>
- <version>${project.version}</version>
</dependency>
-
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowjava-extension-nicira</artifactId>
- <version>${project.version}</version>
</dependency>
-
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-extension-nicira</artifactId>
- <version>${project.version}</version>
</dependency>
-
</dependencies>
-
</project>
<configuration>
<instructions>
<Export-Package>
- org.opendaylight.openflowjava.nx.api, org.opendaylight.openflowjava.nx.api.impl,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.api.config.rev140711
+ org.opendaylight.openflowjava.nx.api, org.opendaylight.openflowjava.nx.api.impl
</Export-Package>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>generate-sources</goal>
- </goals>
- <configuration>
- <codeGenerators>
- <generator>
- <codeGeneratorClass>
- org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- </codeGeneratorClass>
- <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
- <additionalConfiguration>
- <namespaceToPackage1>
- urn:opendaylight:params:xml:ns:yang:controller:config==org.opendaylight.controller.config.yang
- </namespaceToPackage1>
- </additionalConfiguration>
- </generator>
- <generator>
- <codeGeneratorClass>
- org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl
- </codeGeneratorClass>
- <outputBaseDir>${project.build.directory}/generated-sources/sal</outputBaseDir>
- </generator>
- </codeGenerators>
- <inspectDependencies>true</inspectDependencies>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-jmx-generator-plugin</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>maven-sal-api-gen-plugin</artifactId>
- <version>${mdsal.model.version}</version>
- <type>jar</type>
- </dependency>
- </dependencies>
- </plugin>
</plugins>
</build>
/**
* Copyright (c) 2014 Cisco 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
* @author msunal
*
*/
-public interface NiciraExtensionCodecRegistrator {
+public interface NiciraExtensionCodecRegistrator extends AutoCloseable {
void registerActionDeserializer(NiciraActionDeserializerKey key, OFDeserializer<Action> deserializer);
/**
* Copyright (c) 2014 Cisco 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
* @author msunal
*
*/
-public class NiciraExtensionCodecRegistratorImpl implements NiciraExtensionCodecRegistrator, AutoCloseable {
+public class NiciraExtensionCodecRegistratorImpl implements NiciraExtensionCodecRegistrator {
private static final Map<NiciraActionDeserializerKey, OFDeserializer<Action>> actionDeserializers = new ConcurrentHashMap<>();
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.openflow.extension.nicira.api.
* NiciraExtensionCodecRegistrator
* #registerActionDeserializer(org.opendaylight
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.openflow.extension.nicira.api.
* NiciraExtensionCodecRegistrator
* #unregisterActionDeserializer(org.opendaylight
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.openflow.extension.nicira.api.
* NiciraExtensionCodecRegistrator
* #registerActionSerializer(org.opendaylight.
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.openflow.extension.nicira.api.
* NiciraExtensionCodecRegistrator
* #unregisterActionSerializer(org.opendaylight
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.openflow.extension.nicira.api.
* NiciraExtensionCodecRegistrator
* #registerMatchEntryDeserializer(org.opendaylight
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.openflow.extension.nicira.api.
* NiciraExtensionCodecRegistrator
* #unregisterMatchEntryDeserializer(org.opendaylight
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.openflow.extension.nicira.api.
* NiciraExtensionCodecRegistrator
* #registerMatchEntrySerializer(org.opendaylight
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.openflow.extension.nicira.api.
* NiciraExtensionCodecRegistrator
* #unregisterMatchEntrySerializer(org.opendaylight
+++ /dev/null
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.api.config.rev140711;
-
-import org.opendaylight.openflowjava.nx.api.impl.NiciraExtensionCodecRegistratorImpl;
-
-public class NiciraExtensionApiProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.api.config.rev140711.AbstractNiciraExtensionApiProviderModule {
- public NiciraExtensionApiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public NiciraExtensionApiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.api.config.rev140711.NiciraExtensionApiProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new NiciraExtensionCodecRegistratorImpl(getOpenflowSwitchConnectionProviderDependency());
- }
-
-}
+++ /dev/null
-/*
-* Generated file
-*
-* Generated from: yang module name: openflowjava-nx-api-config yang module local name: openflowjava-extension-nicira-api
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Fri Aug 01 15:57:05 CEST 2014
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.api.config.rev140711;
-public class NiciraExtensionApiProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.api.config.rev140711.AbstractNiciraExtensionApiProviderModuleFactory {
-
-}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="defaultSwitchConnProvider"
+ interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+ odl:type="openflow-switch-connection-provider-default-impl"/>
+
+ <reference id="legacySwitchConnProvider"
+ interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+ odl:type="openflow-switch-connection-provider-legacy-impl"/>
+
+ <bean id="niciraExtensionCodecRegistrator"
+ class="org.opendaylight.openflowjava.nx.api.impl.NiciraExtensionCodecRegistratorImpl"
+ destroy-method="close">
+ <argument>
+ <list>
+ <ref component-id="defaultSwitchConnProvider"/>
+ <ref component-id="legacySwitchConnProvider"/>
+ </list>
+ </argument>
+ </bean>
+
+ <service ref="niciraExtensionCodecRegistrator"
+ interface="org.opendaylight.openflowjava.nx.api.NiciraExtensionCodecRegistrator"/>
+</blueprint>
+++ /dev/null
-module openflowjava-nx-api-config {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:openflowplugin:ofjava:nx:api:config";
- prefix "openflowjava-nx-api";
-
- import config {prefix config; revision-date 2013-04-05;}
- import openflow-switch-connection-provider {prefix openflow-switch-connection-provider;revision-date 2014-03-28;}
-
- description
- "Nicira extensions API in openflow library.";
-
- revision "2014-07-11" {
- description
- "Initial revision";
- }
-
- identity openflowjava-extension-nicira-api {
- base config:module-type;
- config:provided-service nicira-extension-codec-registrator;
- config:java-name-prefix NiciraExtensionApiProvider;
- }
-
- identity nicira-extension-codec-registrator {
- base config:service-type;
- config:java-class "org.opendaylight.openflowjava.nx.api.NiciraExtensionCodecRegistrator";
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case openflowjava-extension-nicira-api {
- when "/config:modules/config:module/config:type = 'openflowjava-extension-nicira-api'";
-
- list openflow-switch-connection-provider {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity openflow-switch-connection-provider:openflow-switch-connection-provider;
- }
- }
- }
- }
- }
-}
\ No newline at end of file
</goals>
<configuration>
<codeGenerators>
- <generator>
- <codeGeneratorClass>
- org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- </codeGeneratorClass>
- <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
- <additionalConfiguration>
- <namespaceToPackage1>
- urn:opendaylight:params:xml:ns:yang:controller:config==org.opendaylight.controller.config.yang
- </namespaceToPackage1>
- </additionalConfiguration>
- </generator>
<generator>
<codeGeneratorClass>
org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl
<groupId>${project.groupId}</groupId>
<artifactId>openflowjava-extension-nicira-api</artifactId>
</dependency>
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.mdsal.model</groupId> -->
-<!-- <artifactId>yang-ext</artifactId> -->
-<!-- </dependency> -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
import org.opendaylight.openflowjava.nx.codec.match.EthDstCodec;
import org.opendaylight.openflowjava.nx.codec.match.EthSrcCodec;
import org.opendaylight.openflowjava.nx.codec.match.EthTypeCodec;
+import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
import org.opendaylight.openflowjava.nx.codec.match.Nshc1Codec;
import org.opendaylight.openflowjava.nx.codec.match.Nshc2Codec;
import org.opendaylight.openflowjava.nx.codec.match.Nshc3Codec;
import com.google.common.base.Preconditions;
public class NiciraExtensionsRegistrator implements AutoCloseable {
-
private final NiciraExtensionCodecRegistrator registrator;
- /**
- * @param registrator
- * cannot be null
- */
public NiciraExtensionsRegistrator(NiciraExtensionCodecRegistrator registrator) {
this.registrator = Preconditions.checkNotNull(registrator);
- }
- public void registerNiciraExtensions() {
registrator.registerActionDeserializer(RegLoadCodec.DESERIALIZER_KEY, NiciraActionCodecs.REG_LOAD_CODEC);
registrator.registerActionSerializer(RegLoadCodec.SERIALIZER_KEY, NiciraActionCodecs.REG_LOAD_CODEC);
registrator.registerActionDeserializer(RegMoveCodec.DESERIALIZER_KEY, NiciraActionCodecs.REG_MOVE_CODEC);
registrator.registerMatchEntryDeserializer(CtZoneCodec.DESERIALIZER_KEY, NiciraMatchCodecs.CT_ZONE_CODEC);
}
- public void unregisterExtensions() {
+ @Override
+ public void close() throws Exception {
registrator.unregisterActionDeserializer(RegLoadCodec.DESERIALIZER_KEY);
registrator.unregisterActionSerializer(RegLoadCodec.SERIALIZER_KEY);
registrator.unregisterActionDeserializer(RegMoveCodec.DESERIALIZER_KEY);
registrator.unregisterMatchEntryDeserializer(CtZoneCodec.DESERIALIZER_KEY);
}
- @Override
- public void close() throws Exception {
- unregisterExtensions();
- }
-
}
/*
- * Copyright (c) 2014, 2016 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.openflowjava.nx;
-
-import org.opendaylight.openflowjava.nx.codec.match.ArpOpCodec;
-import org.opendaylight.openflowjava.nx.codec.match.ArpShaCodec;
-import org.opendaylight.openflowjava.nx.codec.match.ArpSpaCodec;
-import org.opendaylight.openflowjava.nx.codec.match.ArpThaCodec;
-import org.opendaylight.openflowjava.nx.codec.match.ArpTpaCodec;
-import org.opendaylight.openflowjava.nx.codec.match.CtStateCodec;
-import org.opendaylight.openflowjava.nx.codec.match.CtZoneCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EncapEthDstCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EncapEthSrcCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EncapEthTypeCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EthDstCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EthSrcCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EthTypeCodec;
-import org.opendaylight.openflowjava.nx.codec.match.IcmpTypeCodec;
-import org.opendaylight.openflowjava.nx.codec.match.InPortCodec;
-import org.opendaylight.openflowjava.nx.codec.match.IpDstCodec;
-import org.opendaylight.openflowjava.nx.codec.match.IpSrcCodec;
-import org.opendaylight.openflowjava.nx.codec.match.Ipv6DstCodec;
-import org.opendaylight.openflowjava.nx.codec.match.Ipv6SrcCodec;
-import org.opendaylight.openflowjava.nx.codec.match.MplsLabelCodec;
-import org.opendaylight.openflowjava.nx.codec.match.NshMdtypeCodec;
-import org.opendaylight.openflowjava.nx.codec.match.NshNpCodec;
-import org.opendaylight.openflowjava.nx.codec.match.Nshc1Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Nshc2Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Nshc3Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Nshc4Codec;
-import org.opendaylight.openflowjava.nx.codec.match.NsiCodec;
-import org.opendaylight.openflowjava.nx.codec.match.NspCodec;
-import org.opendaylight.openflowjava.nx.codec.match.Reg0Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Reg1Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Reg2Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Reg3Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Reg4Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Reg5Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Reg6Codec;
-import org.opendaylight.openflowjava.nx.codec.match.Reg7Codec;
-import org.opendaylight.openflowjava.nx.codec.match.TcpDstCodec;
-import org.opendaylight.openflowjava.nx.codec.match.TcpSrcCodec;
-import org.opendaylight.openflowjava.nx.codec.match.TunGpeNpCodec;
-import org.opendaylight.openflowjava.nx.codec.match.TunIdCodec;
-import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec;
-import org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec;
-import org.opendaylight.openflowjava.nx.codec.match.UdpDstCodec;
-import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
+package org.opendaylight.openflowjava.nx.codec.match;
/**
* @author msunal
+++ /dev/null
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.config.rev140711;
-
-import org.opendaylight.openflowjava.nx.NiciraExtensionsRegistrator;
-
-public class NiciraExtensionProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.config.rev140711.AbstractNiciraExtensionProviderModule {
- public NiciraExtensionProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public NiciraExtensionProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.config.rev140711.NiciraExtensionProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- NiciraExtensionsRegistrator registrator = new NiciraExtensionsRegistrator(getNiciraExtensionCodecRegistratorDependency());
- registrator.registerNiciraExtensions();
- return registrator;
- }
-
-}
+++ /dev/null
-/*
-* Generated file
-*
-* Generated from: yang module name: openflowjava-nx-config yang module local name: openflowjava-extension-nicira
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Fri Aug 01 15:15:42 CEST 2014
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.config.rev140711;
-public class NiciraExtensionProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.ofjava.nx.config.rev140711.AbstractNiciraExtensionProviderModuleFactory {
-
-}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="niciraExtensionCodecRegistrator"
+ interface="org.opendaylight.openflowjava.nx.api.NiciraExtensionCodecRegistrator"/>
+
+ <bean id="niciraExtensionsRegistrator"
+ class="org.opendaylight.openflowjava.nx.NiciraExtensionsRegistrator"
+ destroy-method="close">
+ <argument ref="niciraExtensionCodecRegistrator"/>
+ </bean>
+</blueprint>
+++ /dev/null
-module openflowjava-nx-config {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:openflowplugin:ofjava:nx:config";
- prefix "openflowjava-nx";
-
- import config {prefix config; revision-date 2013-04-05;}
- import openflowjava-nx-api-config {prefix openflowjava-nx-api-config;revision-date 2014-07-11;}
-
- description
- "Nicira extensions in openflow library.";
-
- revision "2014-07-11" {
- description
- "Initial revision";
- }
-
- identity openflowjava-extension-nicira {
- base config:module-type;
- config:java-name-prefix NiciraExtensionProvider;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case openflowjava-extension-nicira {
- when "/config:modules/config:module/config:type = 'openflowjava-extension-nicira'";
-
- container nicira-extension-codec-registrator {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity openflowjava-nx-api-config:nicira-extension-codec-registrator;
- }
- }
- }
- }
- }
-}
\ No newline at end of file
@Test
public void registerNiciraExtensionsTest() {
- niciraExtensionsRegistrator.registerNiciraExtensions();
-
Mockito.verify(registrator).registerActionDeserializer(Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 7)), Matchers.any(RegLoadCodec.class));
Mockito.verify(registrator).registerActionSerializer(Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionRegLoad.class)), Matchers.any(RegLoadCodec.class));
Mockito.verify(registrator).registerActionDeserializer(Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 6)), Matchers.any(RegMoveCodec.class));
}
@Test
- public void unregisterExtensionsTest() {
- niciraExtensionsRegistrator.unregisterExtensions();
+ public void unregisterExtensionsTest() throws Exception {
+ niciraExtensionsRegistrator.close();
Mockito.verify(registrator).unregisterActionDeserializer(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 7));
Mockito.verify(registrator).unregisterActionSerializer(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionRegLoad.class));
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<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.openflowplugin</groupId>
- <artifactId>openflowplugin-extension-parent</artifactId>
- <version>0.5.0-SNAPSHOT</version>
- <relativePath>../</relativePath>
- </parent>
-
- <artifactId>openflowplugin-extension-nicira-config</artifactId>
- <description>Controller Configuration files for Nicira extensions</description>
- <packaging>jar</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts-nicira-extension-config</id>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <artifacts>
- <artifact>
- <file>${project.build.directory}/classes/initial/43-openflowjava-nx-config.xml</file>
- <type>xml</type>
- <classifier>config</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<snapshot>
- <required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:openflowplugin:ofjava:nx:api:config?module=openflowjava-nx-api-config&revision=2014-07-11</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:openflowplugin:ofjava:nx:config?module=openflowjava-nx-config&revision=2014-07-11</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:openflowplugin:extension:api?module=openflowplugin-extension-registry&revision=2015-04-25</capability>
- </required-capabilities>
-
- <configuration>
-
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
- <!-- openflowjava codec registry provider -->
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:openflowplugin:ofjava:nx:api:config">prefix:openflowjava-extension-nicira-api</type>
- <name>openflowjava-extension-nx-api-bundle</name>
-
- <openflow-switch-connection-provider>
- <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>
- <name>openflow-switch-connection-provider-legacy</name>
- </openflow-switch-connection-provider>
- <openflow-switch-connection-provider>
- <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>
- <name>openflow-switch-connection-provider-default</name>
- </openflow-switch-connection-provider>
- </module>
-
- <module>
- <!-- openflowjava codecs -->
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:openflowplugin:ofjava:nx:config">prefix:openflowjava-extension-nicira</type>
- <name>openflow-nx-bundle</name>
-
- <nicira-extension-codec-registrator>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:openflowplugin:ofjava:nx:api:config">prefix:nicira-extension-codec-registrator</type>
- <name>openflowjava-nicira-ext-registrator</name>
- </nicira-extension-codec-registrator>
- </module>
-
- <module>
- <!-- openflowplugin codecs/converters -->
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:openflowplugin:nx:config:impl">prefix:nicira-extension-provider-impl</type>
- <name>nicira-extension-provider-default-impl</name>
-
- <openflow-plugin-extension-registry>
- <type xmlns:ofpExtProv="urn:opendaylight:params:xml:ns:yang:openflowplugin:extension:api">ofpExtProv:openflow-extension-registry-provider</type>
- <name>openflow-ext-provider</name>
- </openflow-plugin-extension-registry>
- </module>
- </modules>
-
- <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <service>
- <!-- exposing openflowjava codec registry provider -->
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:openflowplugin:ofjava:nx:api:config">prefix:nicira-extension-codec-registrator</type>
- <instance>
- <name>openflowjava-nicira-ext-registrator</name>
- <provider>/modules/module[type='openflowjava-extension-nicira-api'][name='openflowjava-extension-nx-api-bundle']</provider>
- </instance>
- </service>
- </services>
- </data>
-
- </configuration>
-</snapshot>
<artifactId>openflowplugin-extension-nicira</artifactId>
<packaging>bundle</packaging>
-
+
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
-
+
<plugin>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-maven-plugin</artifactId>
</goals>
<configuration>
<codeGenerators>
- <generator>
- <codeGeneratorClass>
- org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- </codeGeneratorClass>
- <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
- <additionalConfiguration>
- <namespaceToPackage1>
- urn:opendaylight:params:xml:ns:yang:controller:config==org.opendaylight.controller.config.yang
- </namespaceToPackage1>
- </additionalConfiguration>
- </generator>
<generator>
<codeGeneratorClass>
org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl
<groupId>${project.groupId}</groupId>
<artifactId>openflowjava-extension-nicira-api</artifactId>
</dependency>
- <dependency>
- <!-- configSubsystem yang should be moved to API and this would be doomed for removal -->
- <groupId>org.opendaylight.openflowplugin</groupId>
- <artifactId>openflowplugin</artifactId>
- </dependency>
-
<!-- MD-SAL models -->
<dependency>
- <groupId>org.opendaylight.openflowplugin.model</groupId>
+ <groupId>${project.groupId}.model</groupId>
<artifactId>model-flow-base</artifactId>
</dependency>
<dependency>
- <groupId>org.opendaylight.openflowplugin.model</groupId>
+ <groupId>${project.groupId}.model</groupId>
<artifactId>model-flow-service</artifactId>
</dependency>
<dependency>
- <groupId>org.opendaylight.openflowplugin.model</groupId>
+ <groupId>${project.groupId}.model</groupId>
<artifactId>model-flow-statistics</artifactId>
</dependency>
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-inventory</artifactId>
</dependency>
-
<!-- OpenFlowJava-API models -->
<dependency>
<groupId>org.opendaylight.openflowjava</groupId>
<artifactId>openflow-protocol-api</artifactId>
</dependency>
-
+ <!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
-
</dependencies>
</project>
package org.opendaylight.openflowplugin.extension.vendor.nicira;
import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec;
+import org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIpv4DstKey;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIPv4DstConvertor;
private static final Logger LOG = LoggerFactory.getLogger(NiciraExtensionProvider.class);
- private ExtensionConverterRegistrator extensionConverterRegistrator;
- private Set<ObjectRegistration<?>> registrations;
-
private static final RegConvertor REG_CONVERTOR = new RegConvertor();
private static final TunIdConvertor TUN_ID_CONVERTOR = new TunIdConvertor();
private static final ArpOpConvertor ARP_OP_CONVERTOR = new ArpOpConvertor();
private static final CtStateConvertor CT_STATE_CONVERTOR = new CtStateConvertor();
private static final CtZoneConvertor CT_ZONE_CONVERTOR = new CtZoneConvertor();
- @Override
- public void close() {
- for (AutoCloseable janitor : registrations) {
- try {
- janitor.close();
- } catch (Exception e) {
- LOG.warn("closing of extension converter failed", e);
- }
- }
- extensionConverterRegistrator = null;
- }
-
- /**
- * @param extensionConverterRegistrator
- */
- public void setExtensionConverterRegistrator(final ExtensionConverterRegistrator extensionConverterRegistrator) {
- this.extensionConverterRegistrator = extensionConverterRegistrator;
- }
+ private final ExtensionConverterRegistrator extensionConverterRegistrator;
+ private final Set<ObjectRegistration<?>> registrations;
/**
* register appropriate converters
*/
- public void registerConverters() {
- Preconditions.checkNotNull(extensionConverterRegistrator);
+ public NiciraExtensionProvider(final OpenFlowPluginExtensionRegistratorProvider provider) {
+ this.extensionConverterRegistrator = Preconditions.checkNotNull(provider.getExtensionConverterRegistrator());
registrations = new HashSet<>();
// src=dataStore/config
registerAction13(NxActionRegLoadNodesNodeTableFlowApplyActionsCase.class, REG_LOAD_CONVERTOR);
extensionConverterRegistrator.registerMatchConvertor(CtZoneCodec.SERIALIZER_KEY, CT_ZONE_CONVERTOR));
}
+ @Override
+ public void close() {
+ registrations.forEach(janitor -> {
+ try {
+ janitor.close();
+ } catch (Exception e) {
+ LOG.warn("closing of extension converter failed", e);
+ }
+ });
+
+ registrations.clear();
+ }
+
/**
* @param actionCaseType
* @param actionConvertor
ConvertorActionFromOFJava<
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action,
ActionPath> actionConvertor) {
- ActionSerializerKey<?> key = new ActionSerializerKey(EncodeConstants.OF13_VERSION_ID, actionCaseType, null);
+ ActionSerializerKey<?> key = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, actionCaseType, null);
registrations.add(extensionConverterRegistrator.registerActionConvertor(key, actionConvertor));
}
}
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
import com.google.common.base.Preconditions;
-import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
import org.opendaylight.openflowjava.nx.codec.match.NxmHeader;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import com.google.common.base.Optional;
import java.util.Objects;
-import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
+++ /dev/null
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.nx.config.impl.rev140711;
-
-import org.opendaylight.openflowplugin.extension.api.ExtensionConverterRegistrator;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.NiciraExtensionProvider;
-
-public class ConfigurableNiciraExtensionProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.nx.config.impl.rev140711.AbstractConfigurableNiciraExtensionProviderModule {
- public ConfigurableNiciraExtensionProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public ConfigurableNiciraExtensionProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.nx.config.impl.rev140711.ConfigurableNiciraExtensionProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- NiciraExtensionProvider provider = new NiciraExtensionProvider();
- ExtensionConverterRegistrator registrator = getOpenflowPluginExtensionRegistryDependency().getExtensionConverterRegistrator();
- provider.setExtensionConverterRegistrator(registrator);
- provider.registerConverters();
- return provider;
- }
-
-}
+++ /dev/null
-/*
-* Generated file
-*
-* Generated from: yang module name: nicira-extension-impl yang module local name: nicira-extension-provider-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Fri Aug 01 14:44:34 CEST 2014
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.nx.config.impl.rev140711;
-public class ConfigurableNiciraExtensionProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.nx.config.impl.rev140711.AbstractConfigurableNiciraExtensionProviderModuleFactory {
-
-}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="registratorProvider"
+ interface="org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider"
+ odl:type="openflow-plugin-provider-impl"/>
+
+ <bean id="niciraExtensionProvider"
+ class="org.opendaylight.openflowplugin.extension.vendor.nicira.NiciraExtensionProvider"
+ destroy-method="close">
+ <argument ref="registratorProvider"/>
+ </bean>
+</blueprint>
+++ /dev/null
-module nicira-extension {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:config:openflowplugin:nx:config";
- prefix "niciraExt-cfg";
-
- import config {prefix config; revision-date 2013-04-05; }
-
- description
- "openflow extension for nicira - config";
-
- revision "2014-07-11" {
- description
- "Initial revision";
- }
-
- identity nicira-extension-provider {
- base config:service-type;
- config:java-class "org.opendaylight.openflowplugin.extension.vendor.nicira.NiciraExtensionProvider";
- }
-}
\ No newline at end of file
+++ /dev/null
-module nicira-extension-impl {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:openflowplugin:nx:config:impl";
- prefix "niciraExt-cfg-impl";
-
- import config {prefix config; revision-date 2013-04-05;}
- import openflowplugin-extension-registry {prefix ofp-ext-reg; revision-date 2015-04-25;}
- import nicira-extension {prefix niciraExt-provider;}
-
- description
- "openflow extension for nicira - config-impl";
-
- revision "2014-07-11" {
- description
- "Initial revision";
- }
-
- identity nicira-extension-provider-impl {
- base config:module-type;
- config:provided-service niciraExt-provider:nicira-extension-provider;
- config:java-name-prefix ConfigurableNiciraExtensionProvider;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case nicira-extension-provider-impl {
- when "/config:modules/config:module/config:type = 'nicira-extension-provider-impl'";
-
- container openflow-plugin-extension-registry {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity ofp-ext-reg:openflow-extension-registry-provider;
- }
- }
- }
- }
- }
-}
package org.opendaylight.openflowplugin.extension.vendor.nicira;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.ExtensionConverterRegistrator;
+import org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider;
import org.opendaylight.openflowplugin.extension.api.TypeVersionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@RunWith(MockitoJUnitRunner.class)
public class NiciraExtensionProviderTest {
+ @Mock
+ private OpenFlowPluginExtensionRegistratorProvider openFlowPluginExtensionRegistratorProvider;
+
@Mock
private ExtensionConverterRegistrator extensionConverterRegistrator;
@Before
public void setUp() throws Exception {
-
- niciraExtensionProvider = new NiciraExtensionProvider();
- niciraExtensionProvider.setExtensionConverterRegistrator(extensionConverterRegistrator);
+ Mockito.when(openFlowPluginExtensionRegistratorProvider.getExtensionConverterRegistrator())
+ .thenReturn(extensionConverterRegistrator);
+ niciraExtensionProvider = new NiciraExtensionProvider(openFlowPluginExtensionRegistratorProvider);
}
@Test
public void testRegisterConverters() throws Exception {
- niciraExtensionProvider.registerConverters();
Mockito.verify(extensionConverterRegistrator, Mockito.atLeastOnce()).registerActionConvertor(Matchers.<TypeVersionKey<? extends Action>>any(), Matchers.<ConvertorActionToOFJava<Action, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>>any());
}
-}
\ No newline at end of file
+}
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjNxHashFields;
Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath().getArg());
Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath().getMaxLink());
}
-}
\ No newline at end of file
+}
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg;
Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxOutputReg().getSrc().getOfsNbits());
}
-}
\ No newline at end of file
+}
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoad;
}
-}
\ No newline at end of file
+}
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove;
Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIcmpTypeCase);
}
-}
\ No newline at end of file
+}
<module>openflowjava-extension-nicira</module>
<module>openflowplugin-extension-api</module>
<module>openflowplugin-extension-nicira</module>
- <module>openflowplugin-extension-nicira-config</module>
<module>openflowplugin-extension-onf</module>
<module>test-extension</module>
<module>features-extension-aggregator</module>
<type>cfg</type>
<classifier>config</classifier>
</dependency>
- <dependency>
- <groupId>org.opendaylight.openflowplugin</groupId>
- <artifactId>openflowplugin-controller-config</artifactId>
- <type>xml</type>
- <classifier>configmsgspy</classifier>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.openflowplugin</groupId>
- <artifactId>openflowplugin-controller-config</artifactId>
- <type>xml</type>
- <classifier>config-Li</classifier>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.openflowplugin</groupId>
- <artifactId>openflowplugin-controller-config</artifactId>
- <type>xml</type>
- <classifier>config-He</classifier>
- </dependency>
</dependencies>
</project>
<features name="openflowplugin-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0">
<feature name="odl-openflowplugin-southbound" version="${project.version}">
<configfile finalname="etc/org.opendaylight.openflowplugin.cfg">mvn:org.opendaylight.openflowplugin/openflowplugin-blueprint-config/${project.version}/cfg/config</configfile>
- <configfile finalname="etc/opendaylight/karaf/42-openflowplugin-Li.xml">mvn:org.opendaylight.openflowplugin/openflowplugin-controller-config/${project.version}/xml/config-Li</configfile>
</feature>
</features>