Merge "Fixed deserialization of IdentityRefs in Restconf URI."
authorEd Warnicke <eaw@cisco.com>
Tue, 10 Dec 2013 20:01:51 +0000 (20:01 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 10 Dec 2013 20:01:51 +0000 (20:01 +0000)
141 files changed:
opendaylight/config/logback-config/src/main/yang/config-logging.yang
opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ftl/TemplateFactory.java
opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ftl/model/Field.java
opendaylight/config/yang-jmx-generator-plugin/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/JMXGeneratorTest.java
opendaylight/config/yang-jmx-generator-plugin/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ModuleMXBeanEntryTemplatesTest.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntry.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/TypeProviderWrapper.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/JavaAttribute.java
opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryNameConflictTest.java
opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute-in-runtime-and-mxbean.yang [new file with mode: 0644]
opendaylight/config/yang-test/src/main/yang/config-test-impl.yang
opendaylight/distribution/opendaylight/pom.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/00-netty.conf
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/01-md-sal.conf
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestFromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java
opendaylight/md-sal/forwardingrules-manager/pom.xml
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/forwardingrulesmanager/consumer/impl/FRMUtil.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FRMActivator.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowCommitHandler.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransactionValidator.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupCommitHandler.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransactionValidator.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterCommitHandler.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransactionValidator.java [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-base/src/main/yang/action-types.yang [deleted file]
opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/match-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-action-types.yang [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-flow-types.yang [moved from opendaylight/md-sal/model/model-flow-base/src/main/yang/flow-types.yang with 73% similarity]
opendaylight/md-sal/model/model-flow-service/src/main/yang/flow-node-inventory.yang
opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang [new file with mode: 0644]
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-broker/pom.xml
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/BindingTestUtilities.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/MultipleAugmentationPuts.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTest.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Rpcs.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/AbstractConsumer.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/AbstractProvider.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerConfigActivator.xtend
opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/Client.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/Context.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcClient.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcServer.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RpcSocket.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/Sender.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/ServerImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/SocketManager.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/SocketPair.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/dto/CompositeNodeImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/dto/Message.java [moved from opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/Message.java with 88% similarity]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/dto/MessageWrapper.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/dto/RouteIdentifierImpl.java [moved from opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/RouteIdentifierImpl.java with 54% similarity]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/dto/RpcRequestImpl.java [moved from opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/RpcRequestImpl.java with 94% similarity]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/util/XmlUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/scala/org/opendaylight/controller/sal/connector/remoterpc/Client.scala [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/yang/odl-sal-dom-rpc-remote-cfg.yang [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/RouteIdentifierImplTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/RpcSocketTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/SerilizationTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/SocketManagerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/resources/FourSimpleChildren.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/pom.xml [moved from opendaylight/md-sal/test/zeromq-test-consumer/pom.xml with 87% similarity]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/java/org/opendaylight/controller/sample/zeromq/consumer/ExampleConsumer.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/resources/FourSimpleChildren.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/resources/InvalidCompositeChild.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/resources/InvalidSimpleChild.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/resources/OneSimpleChild.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/resources/OneSimpleOneCompositeChild.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/resources/TwoCompositeChildren.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/resources/TwoSimpleChildren.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/pom.xml [moved from opendaylight/md-sal/test/zeromq-test-provider/pom.xml with 89% similarity]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/src/main/java/org/opendaylight/controller/sample/zeromq/provider/ExampleProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/src/test/java/org/opendaylight/controller/sample/zeromq/test/it/RouterTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/src/test/resources/controller.config [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/src/test/resources/logback.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlProvidersTest.java
opendaylight/md-sal/sal-zeromq-connector/pom.xml [deleted file]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/api/RouteChange.java [deleted file]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/Activator.java [deleted file]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/ZeroMqRpcRouter.java [deleted file]
opendaylight/md-sal/test/pom.xml [deleted file]
opendaylight/md-sal/test/zeromq-test-consumer/src/main/java/org/opendaylight/controller/sample/zeromq/consumer/ExampleConsumer.java [deleted file]
opendaylight/md-sal/test/zeromq-test-it/pom.xml [deleted file]
opendaylight/md-sal/test/zeromq-test-it/src/test/java/org/opendaylight/controller/sample/zeromq/test/it/ServiceConsumerController.java [deleted file]
opendaylight/md-sal/test/zeromq-test-it/src/test/java/org/opendaylight/controller/sample/zeromq/test/it/ServiceProviderController.java [deleted file]
opendaylight/md-sal/test/zeromq-test-provider/src/main/java/org/opendaylight/controller/sample/zeromq/provider/ExampleProvider.java [deleted file]
opendaylight/md-sal/zeromq-routingtable/implementation/pom.xml
opendaylight/netconf/config-netconf-connector/pom.xml
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AbstractAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AttributeConfigElement.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/ObjectXmlReader.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/SimpleAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/SimpleBinaryAttributeReadingStrategy.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/SimpleCompositeAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/ObjectXmlWriter.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleBinaryAttributeWritingStrategy.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/NetconfMappingTest.java
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/editConfig.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/editConfig_none.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/namespaces/editConfig_differentNamespaceTO.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/namespaces/editConfig_typeNameConfigAttributeMatching.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised7.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised8.xml
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceShim.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeTableStatistics.java
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/UserConfig.java
opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java
opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java
opendaylight/web/root/src/main/java/org/opendaylight/controller/web/UserBean.java [new file with mode: 0644]

index 7f4ea39..3b28b57 100644 (file)
@@ -51,6 +51,7 @@ module config-logging {
                     type string;
                     mandatory true;
                 }
+                key name;
                 config:java-name-prefix FileAppenderTO;
             }
             
@@ -89,6 +90,7 @@ module config-logging {
                     type string;
                     mandatory true;
                 }
+                key name;
 
                 leaf file-name-pattern {
                     type string;
@@ -107,7 +109,7 @@ module config-logging {
                 
                 leaf clean-history-on-start {
                     type boolean;
-                    default 0;
+                    default false;
                 }
                 config:java-name-prefix RollingFileAppenderTO;
             }
@@ -128,6 +130,8 @@ module config-logging {
                     type string;
                     mandatory true;
                 }
+                key name;
+
                 config:java-name-prefix ConsoleAppenderTO;
             }
 
@@ -136,6 +140,7 @@ module config-logging {
                     type string;
                     mandatory true;
                 }
+                key logger-name;
 
                 leaf level {
                     type string;
index 6da6801..115bb85 100644 (file)
@@ -129,7 +129,7 @@ public class TemplateFactory {
                 for (JavaAttribute ja : rpc.getParameters()) {
                     Field field = new Field(Collections.<String> emptyList(),
                             ja.getType().getFullyQualifiedName(),
-                            ja.getLowerCaseCammelCase());
+                            ja.getLowerCaseCammelCase(), ja.getNullableDefaultWrappedForCode());
                     fields.add(field);
                 }
                 MethodDeclaration operation = new MethodDeclaration(
@@ -433,15 +433,18 @@ public class TemplateFactory {
                     String varName = BindingGeneratorUtil
                             .parseToValidParamName(attrEntry.getKey());
 
-                    String fullyQualifiedName;
+                    String fullyQualifiedName, nullableDefault = null;
                     if (attrEntry.getValue() instanceof TypedAttribute) {
                         Type type = ((TypedAttribute) attrEntry.getValue()).getType();
                         fullyQualifiedName = serializeType(type);
+                        if(attrEntry.getValue() instanceof JavaAttribute) {
+                            nullableDefault = ((JavaAttribute)attrEntry.getValue()).getNullableDefaultWrappedForCode();
+                        }
                     } else {
                         fullyQualifiedName = FullyQualifiedNameHelper
                                 .getFullyQualifiedName(packageName, attrEntry.getValue().getUpperCaseCammelCase());
                     }
-                    fields.add(new Field(fullyQualifiedName, varName));
+                    fields.add(new Field(fullyQualifiedName, varName, nullableDefault));
 
                     String getterName = "get" + innerName;
                     MethodDefinition getter = new MethodDefinition(
@@ -531,6 +534,7 @@ public class TemplateFactory {
                 String packageName) {
             for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
                 String type;
+                String nullableDefaultWrapped = null;
                 AttributeIfc attributeIfc = attrEntry.getValue();
 
                 if (attributeIfc instanceof TypedAttribute) {
@@ -548,6 +552,7 @@ public class TemplateFactory {
                     if (innerAttr instanceof JavaAttribute) {
                         fullyQualifiedName = ((JavaAttribute) innerAttr)
                                 .getType().getFullyQualifiedName();
+                        nullableDefaultWrapped = ((JavaAttribute) innerAttr).getNullableDefaultWrappedForCode();
                     } else if (innerAttr instanceof TOAttribute) {
                         fullyQualifiedName = FullyQualifiedNameHelper
                                 .getFullyQualifiedName(packageName, innerAttr.getUpperCaseCammelCase());
@@ -563,7 +568,7 @@ public class TemplateFactory {
                 }
 
                 fields.add(new Field(type, attributeIfc
-                        .getUpperCaseCammelCase()));
+                        .getUpperCaseCammelCase(), nullableDefaultWrapped));
             }
         }
 
@@ -582,12 +587,16 @@ public class TemplateFactory {
         void processAttributes(Map<String, AttributeIfc> attributes,
                 String packageName) {
             for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
-                String type;
+                String type, nullableDefaultWrapped = null;
                 AttributeIfc attributeIfc = attrEntry.getValue();
 
                 if (attributeIfc instanceof TypedAttribute) {
                     TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
                     type = serializeType(typedAttribute.getType());
+                    if (attributeIfc instanceof JavaAttribute) {
+                        nullableDefaultWrapped = ((JavaAttribute) attributeIfc).getNullableDefaultWrappedForCode();
+                    }
+
                 } else if (attributeIfc instanceof TOAttribute) {
                     String fullyQualifiedName = FullyQualifiedNameHelper
                             .getFullyQualifiedName(packageName, attributeIfc.getUpperCaseCammelCase());
@@ -600,6 +609,7 @@ public class TemplateFactory {
                     if (innerAttr instanceof JavaAttribute) {
                         fullyQualifiedName = ((JavaAttribute) innerAttr)
                                 .getType().getFullyQualifiedName();
+                        nullableDefaultWrapped = ((JavaAttribute) innerAttr).getNullableDefaultWrappedForCode();
                     } else if (innerAttr instanceof TOAttribute) {
                         fullyQualifiedName = FullyQualifiedNameHelper
                                 .getFullyQualifiedName(packageName, innerAttr.getUpperCaseCammelCase());
@@ -631,8 +641,7 @@ public class TemplateFactory {
                 String varName = BindingGeneratorUtil
                         .parseToValidParamName(attrEntry.getKey());
                 moduleFields.add(new ModuleField(type, varName, attributeIfc
-                        .getUpperCaseCammelCase(), attributeIfc
-                        .getNullableDefault(), isDependency, dependency));
+                        .getUpperCaseCammelCase(), nullableDefaultWrapped, isDependency, dependency));
 
                 String getterName = "get"
                         + attributeIfc.getUpperCaseCammelCase();
index fe9e885..0857ec6 100644 (file)
@@ -7,10 +7,10 @@
  */
 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model;
 
-import java.util.List;
-
 import com.google.common.collect.Lists;
 
+import java.util.List;
+
 public class Field {
     private final String type;
     private final String name;
@@ -21,6 +21,10 @@ public class Field {
         this(Lists.<String> newArrayList(), type, name, null);
     }
 
+    public Field(String type, String name, String definition) {
+        this(Lists.<String> newArrayList(), type, name, definition);
+    }
+
     public Field(List<String> modifiers, String type, String name) {
         this(modifiers, type, name, null);
     }
index 2f14374..1945cac 100644 (file)
@@ -534,7 +534,7 @@ public class JMXGeneratorTest extends AbstractGeneratorTest {
         assertDeclaredField(fieldDeclarations,
                 "private java.util.concurrent.ThreadFactory threadfactoryDependency");
         assertDeclaredField(fieldDeclarations,
-                "private java.lang.Long keepAlive=10");
+                "private java.lang.Long keepAlive=new java.lang.Long(\"10\")");
         assertDeclaredField(fieldDeclarations,
                 "private java.lang.Long coreSize");
         assertDeclaredField(fieldDeclarations, "private byte[] binary");
index 3c47931..48d5b30 100644 (file)
@@ -7,14 +7,7 @@
  */
 package org.opendaylight.controller.config.yangjmxgenerator.plugin;
 
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
-import java.util.Collections;
-import java.util.Map;
-
+import com.google.common.collect.Maps;
 import org.junit.Test;
 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
@@ -23,7 +16,13 @@ import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.AbstractFa
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory;
 import org.opendaylight.yangtools.sal.binding.model.api.Type;
 
-import com.google.common.collect.Maps;
+import java.util.Collections;
+import java.util.Map;
+
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 
 public class ModuleMXBeanEntryTemplatesTest {
 
@@ -61,6 +60,7 @@ public class ModuleMXBeanEntryTemplatesTest {
         doReturn("package.type").when(typeA).getFullyQualifiedName();
         doReturn(typeA).when(attr).getType();
         doReturn("Type").when(attr).getUpperCaseCammelCase();
+        doReturn("new Default()").when(attr).getNullableDefault();
         return attr;
     }
 
index a7110b8..4eba739 100644 (file)
@@ -7,9 +7,21 @@
  */
 package org.opendaylight.controller.config.yangjmxgenerator;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static java.lang.String.format;
+import static org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants.createConfigQName;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.AbstractDependencyAttribute;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.DependencyAttribute;
@@ -41,20 +53,9 @@ import org.opendaylight.yangtools.yang.model.api.UsesNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static java.lang.String.format;
-import static org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants.createConfigQName;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Optional;
+import com.google.common.collect.Sets;
 
 /**
  * Represents part of yang model that describes a module.
@@ -184,8 +185,9 @@ public class ModuleMXBeanEntry extends AbstractEntry {
     }
 
     /**
-     * @return services implemented by this module. Keys are fully qualified java names of generated
-     * ServiceInterface classes, values are identity local names.
+     * @return services implemented by this module. Keys are fully qualified
+     *         java names of generated ServiceInterface classes, values are
+     *         identity local names.
      */
     public Map<String, QName> getProvidedServices() {
         return providedServices;
@@ -360,7 +362,6 @@ public class ModuleMXBeanEntry extends AbstractEntry {
                                     e.getConflictingName(), when.getQName(),
                                     when.getQName());
                         }
-
                         checkUniqueRuntimeBeansGeneratedClasses(
                                 uniqueGeneratedClassesNames, when, runtimeBeans);
                         Set<RuntimeBeanEntry> runtimeBeanEntryValues = Sets
@@ -415,6 +416,11 @@ public class ModuleMXBeanEntry extends AbstractEntry {
                         .<RuntimeBeanEntry> emptyList());
             }
         }
+        // check attributes name uniqueness
+        for (Entry<String, ModuleMXBeanEntry> entry : result.entrySet()) {
+            checkUniqueRuntimeBeanAttributesName(entry.getValue(),
+                    uniqueGeneratedClassesNames);
+        }
         if (unaugmentedModuleIdentities.size() > 0) {
             logger.warn("Augmentation not found for all module identities: {}",
                     unaugmentedModuleIdentities.keySet());
@@ -443,6 +449,25 @@ public class ModuleMXBeanEntry extends AbstractEntry {
         }
     }
 
+    private static void checkUniqueRuntimeBeanAttributesName(
+            ModuleMXBeanEntry mxBeanEntry,
+            Map<String, QName> uniqueGeneratedClassesNames) {
+        for (RuntimeBeanEntry runtimeBeanEntry : mxBeanEntry.getRuntimeBeans()) {
+            for (String runtimeAttName : runtimeBeanEntry
+                    .getYangPropertiesToTypesMap().keySet()) {
+                if (mxBeanEntry.getAttributes().keySet()
+                        .contains(runtimeAttName)) {
+                    QName qName1 = uniqueGeneratedClassesNames
+                            .get(runtimeBeanEntry.getJavaNameOfRuntimeMXBean());
+                    QName qName2 = uniqueGeneratedClassesNames.get(mxBeanEntry
+                            .getGloballyUniqueName());
+                    throw new NameConflictException(runtimeAttName, qName1,
+                            qName2);
+                }
+            }
+        }
+    }
+
     private static void checkUniqueAttributesWithGeneratedClass(
             Map<String, QName> uniqueGeneratedClassNames, QName parentQName,
             Map<String, AttributeIfc> yangToAttributes) {
@@ -566,7 +591,8 @@ public class ModuleMXBeanEntry extends AbstractEntry {
     private static AttributeIfc getAttributeValue(DataSchemaNode attrNode,
             Module currentModule,
             Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
-            TypeProviderWrapper typeProviderWrapper, SchemaContext schemaContext, String packageName) {
+            TypeProviderWrapper typeProviderWrapper,
+            SchemaContext schemaContext, String packageName) {
 
         if (attrNode instanceof LeafSchemaNode) {
             // simple type
@@ -575,12 +601,14 @@ public class ModuleMXBeanEntry extends AbstractEntry {
         } else if (attrNode instanceof ContainerSchemaNode) {
             // reference or TO
             ContainerSchemaNode containerSchemaNode = (ContainerSchemaNode) attrNode;
-            Optional<? extends AbstractDependencyAttribute> dependencyAttributeOptional = extractDependency(containerSchemaNode,
-                    attrNode, currentModule, qNamesToSIEs, schemaContext);
+            Optional<? extends AbstractDependencyAttribute> dependencyAttributeOptional = extractDependency(
+                    containerSchemaNode, attrNode, currentModule, qNamesToSIEs,
+                    schemaContext);
             if (dependencyAttributeOptional.isPresent()) {
                 return dependencyAttributeOptional.get();
             } else {
-                return TOAttribute.create(containerSchemaNode, typeProviderWrapper, packageName);
+                return TOAttribute.create(containerSchemaNode,
+                        typeProviderWrapper, packageName);
             }
 
         } else if (attrNode instanceof LeafListSchemaNode) {
@@ -588,12 +616,14 @@ public class ModuleMXBeanEntry extends AbstractEntry {
                     typeProviderWrapper);
         } else if (attrNode instanceof ListSchemaNode) {
             ListSchemaNode listSchemaNode = (ListSchemaNode) attrNode;
-            Optional<? extends AbstractDependencyAttribute> dependencyAttributeOptional = extractDependency(listSchemaNode,
-                    attrNode, currentModule, qNamesToSIEs, schemaContext);
+            Optional<? extends AbstractDependencyAttribute> dependencyAttributeOptional = extractDependency(
+                    listSchemaNode, attrNode, currentModule, qNamesToSIEs,
+                    schemaContext);
             if (dependencyAttributeOptional.isPresent()) {
                 return dependencyAttributeOptional.get();
             } else {
-                return ListAttribute.create(listSchemaNode, typeProviderWrapper, packageName);
+                return ListAttribute.create(listSchemaNode,
+                        typeProviderWrapper, packageName);
             }
         } else {
             throw new UnsupportedOperationException(
@@ -601,16 +631,15 @@ public class ModuleMXBeanEntry extends AbstractEntry {
         }
     }
 
-    private static Optional<? extends AbstractDependencyAttribute> extractDependency(DataNodeContainer dataNodeContainer,
-                                                            DataSchemaNode attrNode,
-                                                            Module currentModule,
-                                                            Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
-                                                            SchemaContext schemaContext) {
+    private static Optional<? extends AbstractDependencyAttribute> extractDependency(
+            DataNodeContainer dataNodeContainer, DataSchemaNode attrNode,
+            Module currentModule,
+            Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
+            SchemaContext schemaContext) {
         if (dataNodeContainer.getUses().size() == 1
                 && getChildNodeSizeWithoutUses(dataNodeContainer) == 0) {
             // reference
-            UsesNode usesNode = dataNodeContainer.getUses().iterator()
-                    .next();
+            UsesNode usesNode = dataNodeContainer.getUses().iterator().next();
             checkState(usesNode.getRefines().size() == 1,
                     "Unexpected 'refine' child node size of "
                             + dataNodeContainer);
@@ -618,26 +647,28 @@ public class ModuleMXBeanEntry extends AbstractEntry {
                     .values().iterator().next();
             checkState(refine.getUnknownSchemaNodes().size() == 1,
                     "Unexpected unknown schema node size of " + refine);
-            UnknownSchemaNode requiredIdentity = refine
-                    .getUnknownSchemaNodes().iterator().next();
+            UnknownSchemaNode requiredIdentity = refine.getUnknownSchemaNodes()
+                    .iterator().next();
             checkState(
                     ConfigConstants.REQUIRED_IDENTITY_EXTENSION_QNAME.equals(requiredIdentity
-                            .getNodeType()),
-                    "Unexpected language extension " + requiredIdentity);
+                            .getNodeType()), "Unexpected language extension "
+                            + requiredIdentity);
             String prefixAndIdentityLocalName = requiredIdentity
                     .getNodeParameter();
             // import should point to a module
             ServiceInterfaceEntry serviceInterfaceEntry = findSIE(
-                    prefixAndIdentityLocalName, currentModule,
-                    qNamesToSIEs, schemaContext);
+                    prefixAndIdentityLocalName, currentModule, qNamesToSIEs,
+                    schemaContext);
             boolean mandatory = refine.getConstraints().isMandatory();
             AbstractDependencyAttribute reference;
-            if (dataNodeContainer instanceof ContainerSchemaNode ){
-                reference = new DependencyAttribute(attrNode, serviceInterfaceEntry,
-                    mandatory, attrNode.getDescription());
+            if (dataNodeContainer instanceof ContainerSchemaNode) {
+                reference = new DependencyAttribute(attrNode,
+                        serviceInterfaceEntry, mandatory,
+                        attrNode.getDescription());
             } else {
-                reference = new ListDependenciesAttribute(attrNode, serviceInterfaceEntry,
-                        mandatory, attrNode.getDescription());
+                reference = new ListDependenciesAttribute(attrNode,
+                        serviceInterfaceEntry, mandatory,
+                        attrNode.getDescription());
             }
             return Optional.of(reference);
         }
index a2238d1..764ecd3 100644 (file)
@@ -26,6 +26,10 @@ public class TypeProviderWrapper {
         return getType(leaf, type);
     }
 
+    public String getDefault(LeafSchemaNode node) {
+        return typeProvider.getTypeDefaultConstruction(node);
+    }
+
     public Type getType(SchemaNode leaf, TypeDefinition<?> type) {
         Type javaType;
         try {
index 325ca9e..3e20e4a 100644 (file)
@@ -22,7 +22,7 @@ import javax.management.openmbean.SimpleType;
 public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
 
     private final Type type;
-    private final String nullableDescription, nullableDefault;
+    private final String nullableDescription, nullableDefault, nullableDefaultWrappedForCode;
     private final TypeProviderWrapper typeProviderWrapper;
     private final TypeDefinition<?> typeDefinition;
 
@@ -33,6 +33,7 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
         this.typeDefinition = leaf.getType();
         this.typeProviderWrapper = typeProviderWrapper;
         this.nullableDefault = leaf.getDefault();
+        this.nullableDefaultWrappedForCode = leaf.getDefault() == null ? null : typeProviderWrapper.getDefault(leaf);
         this.nullableDescription = leaf.getDescription();
     }
 
@@ -42,10 +43,14 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
         this.type = typeProviderWrapper.getType(leaf);
         this.typeDefinition = leaf.getType();
         this.typeProviderWrapper = typeProviderWrapper;
-        this.nullableDefault = null;
+        this.nullableDefault = nullableDefaultWrappedForCode = null;
         this.nullableDescription = leaf.getDescription();
     }
 
+    public TypeDefinition<?> getTypeDefinition() {
+        return typeDefinition;
+    }
+
     /**
      * Returns the most base type
      */
@@ -56,6 +61,10 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
         return baseType;
     }
 
+    public String getNullableDefaultWrappedForCode() {
+        return nullableDefaultWrappedForCode;
+    }
+
     @Override
     public Type getType() {
         return type;
index deef08a..9032a2c 100644 (file)
@@ -100,6 +100,9 @@ public class ModuleMXBeanEntryNameConflictTest extends AbstractYangTest {
         testedYangModulesToExpectedConflictingName.put(
                 "config-test-runtime-bean-name-conflict2",
                 "StateARuntimeMXBean");
+        testedYangModulesToExpectedConflictingName.put(
+                "config-test-duplicate-attribute-in-runtime-and-mxbean",
+                "port");
     }
 
     private String getYangModuleName(String name) {
diff --git a/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute-in-runtime-and-mxbean.yang b/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute-in-runtime-and-mxbean.yang
new file mode 100644 (file)
index 0000000..58c3af2
--- /dev/null
@@ -0,0 +1,57 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-test-duplicate-attribute-in-runtime-and-mxbean {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:jmx:duplicate:runtime";
+    prefix "th-java";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+    import ietf-inet-types { prefix inet; revision-date 2010-09-24;}
+
+
+    description
+        "This module contains the base YANG definitions for NS-OS
+         thread services pure Java implementation.";
+
+    revision "2013-04-05" {
+        description
+            "Updated to work with new anchors.";
+    }
+
+    revision "2013-04-03" {
+        description
+            "Initial revision.";
+    }
+
+   identity async-eventbus {
+        base config:module-type;
+        config:java-name-prefix AsyncEventBus;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case async-eventbus {
+            when "/config:modules/config:module/config:type = 'async-eventbus'";
+            leaf port {
+                type string;
+            }
+            leaf core-size {
+                type uint32;
+            }
+            leaf simple-int3 {
+                type uint16;
+            }
+        }
+    }
+
+    augment "/config:modules/config:module/config:state" {
+        case async-eventbus {
+            when "/config:modules/config:module/config:type = 'async-eventbus'";
+            leaf simple-arg {
+                type uint32;
+            }
+            leaf port {
+                type inet:port-number;
+            }
+        }
+    }
+}
\ No newline at end of file
index bd83a4c..9ad7a44 100644 (file)
@@ -48,28 +48,40 @@ module config-test-impl {
            container dto-a {
                 leaf simple-arg {
                     type uint32;
+                    default 1;
                 }
 
                 leaf port {
                     type inet:port-number;
+                    default 8080;
                 }
 
+                leaf ip4 {
+                    type inet:ipv4-address;
+                    default 127.0.0.1;
+                }
+
+                leaf ip {
+                    type inet:ip-address;
+                    // TODO defaults for union default 0:0:0:0:0:0:0:1;
+                }
             }
 
             leaf as-number {
-                mandatory true;
                 type inet:as-number;
+                default 44;
             }
 
 
             leaf simpleInt {
                 type uint32;
-                default 99L;
+                default 99;
             }
 
             container dto_b {
                 leaf simple-int1 {
                     type uint32;
+                    default 32;
                 }
 
                 leaf simple-int2 {
@@ -101,28 +113,34 @@ module config-test-impl {
             when "/config:modules/config:module/config:type = 'impl-netconf'";
             leaf binaryLeaf {
                 type binary;
+                default ZGVmYXVsdEJpbg==;
             }
 
             leaf type {
                 type string;
+                default "default-string";
             }
 
             leaf extended {
                 type tt:extend-once;
+                default 1;
             }
 
             leaf extended-twice {
                 type tt:extend-twice;
+                default 2;
             }
 
             leaf extended-enum {
                 type tt:extend-enum;
+                default ONE;
             }
 
             leaf sleep-factor {
                 type decimal64 {
                     fraction-digits 2;
                 }
+                default 2.00;
             }
 
            container dto-c {
@@ -153,23 +171,28 @@ module config-test-impl {
             }
 
             leaf simple-long {
-                type int64  ;
+                type int64;
+                default -45;
             }
 
             leaf simple-long-2 {
                 type uint32;
+                default 445;
             }
 
             leaf simple-BigInteger {
                 type uint64;
+                default 545454;
             }
 
             leaf simple-byte {
                 type int8;
+                default -4;
             }
 
             leaf simple-short {
                 type uint8;
+                default 45;
             }
 
             leaf simple-test {
@@ -209,6 +232,7 @@ module config-test-impl {
                     container deep {
                         leaf simple-int3 {
                             type uint16;
+                            default 0;
                         }
                     }
                 }
@@ -393,6 +417,7 @@ module config-test-impl {
             container retValContainer {
                 leaf v1 {
                     type string;
+                    default "from rpc";
                 }
 
                 leaf v2 {
index adc0c09..4c0b81f 100644 (file)
          <groupId>org.opendaylight.controller.thirdparty</groupId>
          <artifactId>ganymed</artifactId>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>sal-remoterpc-connector</artifactId>
+          <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+              <groupId>org.opendaylight.controller</groupId>
+              <artifactId>
+                  zeromq-routingtable.implementation
+              </artifactId>
+              <version>0.4.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+              <groupId>org.zeromq</groupId>
+              <artifactId>jeromq</artifactId>
+              <version>0.3.1</version>
+          </dependency>
       </dependencies>
     </profile>
     <profile>
index e83fdcc..c2f9bc3 100644 (file)
                <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
                <instance>
                        <name>global-boss-group</name>
-                       <provider>/config/modules/module[name='netty-threadgroup-fixed']/instance[name='global-boss-group']</provider>
+                       <provider>/modules/module[type='netty-threadgroup-fixed'][name='global-boss-group']</provider>
                </instance>
                <instance>
                        <name>global-worker-group</name>
-                       <provider>/config/modules/module[name='netty-threadgroup-fixed']/instance[name='global-worker-group']</provider>
+                       <provider>/modules/module[type='netty-threadgroup-fixed'][name='global-worker-group']</provider>
                </instance>
        </service>
        <service>
                <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-event-executor</type>
                <instance>
                        <name>global-event-executor</name>
-                       <provider>/config/modules/module[name='netty-global-event-executor']/instance[name='global-event-executor']</provider>
+                       <provider>/modules/module[type='netty-global-event-executor'][name='global-event-executor']</provider>
                </instance>
        </service>
        <service>
                <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-timer</type>
                <instance>
                        <name>global-timer</name>
-                       <provider>/config/modules/module[name='netty-hashed-wheel-timer']/instance[name='global-timer']</provider>
+                       <provider>/modules/module[type='netty-hashed-wheel-timer'][name='global-timer']</provider>
                </instance>
        </service>
 //CAPABILITIES START
index 430a278..fa33215 100644 (file)
                <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
                <instance>
                        <name>ref_yang-schema-service</name>
-                       <provider>/config/modules/module[name='schema-service-singleton']/instance[name='yang-schema-service']</provider>
+                       <provider>/modules/module[type='schema-service-singleton'][name='yang-schema-service']</provider>
                </instance>
        </service>
        <service>
                <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-notification-service</type>
                <instance>
                        <name>ref_binding-notification-broker</name>
-                       <provider>/config/modules/module[name='binding-notification-broker']/instance[name='binding-notification-broker']</provider>
+                       <provider>/modules/module[type='binding-notification-broker'][name='binding-notification-broker']</provider>
                </instance>
        </service>
        <service>
                <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-data-store</type>
                <instance>
                        <name>ref_hash-map-data-store</name>
-                       <provider>/config/modules/module[name='hash-map-data-store']/instance[name='hash-map-data-store']</provider>
+                       <provider>/modules/module[type='hash-map-data-store'][name='hash-map-data-store']</provider>
                </instance>
                <instance>
-            <name>ref_cluster-data-store</name>
-            <provider>/config/modules/module[name='dom-clustered-store-impl']/instance[name='cluster-data-store']</provider>
-        </instance>
+                       <name>ref_cluster-data-store</name>
+                       <provider>/modules/module[type='dom-clustered-store-impl'][name='cluster-data-store']</provider>
+               </instance>
        </service>
        <service>
                <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
                <instance>
                        <name>ref_binding-broker-impl</name>
-                       <provider>/config/modules/module[name='binding-broker-impl']/instance[name='binding-broker-impl']</provider>
+                       <provider>/modules/module[type='binding-broker-impl'][name='binding-broker-impl']</provider>
                </instance>
        </service>
        <service>
                <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
                <instance>
-                       <name>ref_binding-rpc-broker</name>
-                       <provider>/config/modules/module[name='binding-broker-impl']/instance[name='binding-broker-impl']</provider>
+                       <name>binding-rpc-broker</name>
+                       <provider>/modules/module[type='binding-broker-impl'][name='binding-broker-impl']</provider>
                </instance>
        </service>
        <service>
                <type xmlns:binding-impl="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding-impl:binding-dom-mapping-service</type>
                <instance>
                        <name>ref_runtime-mapping-singleton</name>
-                       <provider>/config/modules/module[name='runtime-generated-mapping']/instance[name='runtime-mapping-singleton']</provider>
+                       <provider>/modules/module[type='runtime-generated-mapping'][name='runtime-mapping-singleton']</provider>
                </instance>
        </service>
        <service>
        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
                <instance>
                        <name>ref_dom-broker</name>
-                       <provider>/config/modules/module[name='dom-broker-impl']/instance[name='dom-broker']</provider>
+                       <provider>/modules/module[type='dom-broker-impl'][name='dom-broker']</provider>
                </instance>
        </service>
        <service>
                <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-data-broker</type>
                <instance>
                        <name>ref_binding-data-broker</name>
-                       <provider>/config/modules/module[name='binding-data-broker']/instance[name='binding-data-broker']</provider>
+                       <provider>/modules/module[type='binding-data-broker'][name='binding-data-broker']</provider>
                </instance>
        </service>
 //CAPABILITIES START
index 1e33481..6cf728c 100644 (file)
@@ -42,28 +42,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.Remo
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsInputBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder
@@ -80,9 +58,54 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder
 import java.util.Collections
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder
 
 public class MDFlowMapping {
 
@@ -114,7 +137,7 @@ public class MDFlowMapping {
     public static def Instructions toApplyInstruction(ArrayList<Action> actions) {
         val it = new InstructionsBuilder;
         val applyActions = new InstructionBuilder;
-        applyActions.instruction = new ApplyActionsBuilder().setAction(actions).build()
+        applyActions.instruction = new ApplyActionsCaseBuilder().setApplyActions(new ApplyActionsBuilder().setAction(actions).build()).build()
         instruction = Collections.<Instruction>singletonList(applyActions.build)
         return it.build;
     }
@@ -153,37 +176,37 @@ public class MDFlowMapping {
 
     public static dispatch def toAction(Controller sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new ControllerActionBuilder().build();
+        actionBuilder.action = new ControllerActionCaseBuilder().setControllerAction(new ControllerActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(Drop sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new DropActionBuilder().build();
+        actionBuilder.action = new DropActionCaseBuilder().setDropAction(new DropActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(Flood sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new FloodActionBuilder().build();
+        actionBuilder.action = new FloodActionCaseBuilder().setFloodAction(new FloodActionBuilder().build).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(FloodAll sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new FloodAllActionBuilder().build();
+        actionBuilder.action = new FloodAllActionCaseBuilder().setFloodAllAction(new FloodAllActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(HwPath sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new HwPathActionBuilder().build();
+        actionBuilder.action = new HwPathActionCaseBuilder().setHwPathAction(new HwPathActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(Loopback sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new LoopbackActionBuilder().build();
+        actionBuilder.action = new LoopbackActionCaseBuilder().setLoopbackAction(new LoopbackActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
@@ -191,14 +214,14 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new OutputActionBuilder();
         outputNodeConnector = sourceAction.port.toUri;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new OutputActionCaseBuilder().setOutputAction(it.build()).build();
         return actionBuilder.build();
 
     }
 
     public static dispatch def toAction(PopVlan sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new PopVlanActionBuilder().build();
+        actionBuilder.action = new PopVlanActionCaseBuilder().build();
         return actionBuilder.build();
     }
 
@@ -209,7 +232,7 @@ public class MDFlowMapping {
         vlanId = new VlanId(sourceAction.vlanId);
         pcp = sourceAction.pcp;
         tag = sourceAction.tag;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new PushVlanActionCaseBuilder().setPushVlanAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -217,7 +240,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetDlDstActionBuilder();
         address = sourceAction.dlAddress.toMacAddress();
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetDlDstActionCaseBuilder().setSetDlDstAction(it.build()).build;
         return actionBuilder.build();
     }
 
@@ -225,7 +248,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetDlSrcActionBuilder();
         address = sourceAction.dlAddress.toMacAddress;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetDlSrcActionCaseBuilder().setSetDlSrcAction(it.build()).build;
         return actionBuilder.build();
     }
 
@@ -233,7 +256,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetDlTypeActionBuilder();
         dlType = new EtherType(sourceAction.dlType as long);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetDlTypeActionCaseBuilder().setSetDlTypeAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -242,7 +265,7 @@ public class MDFlowMapping {
         val it = new SetNextHopActionBuilder();
         val inetAddress = sourceAction.address;
         address = inetAddress.toInetAddress;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetNextHopActionCaseBuilder().setSetNextHopAction(it.build).build();
         return actionBuilder.build();
     }
 
@@ -251,7 +274,7 @@ public class MDFlowMapping {
         val it = new SetNwDstActionBuilder();
         val inetAddress = sourceAction.address;
         address = inetAddress.toInetAddress;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetNwDstActionCaseBuilder().setSetNwDstAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -260,7 +283,7 @@ public class MDFlowMapping {
         val it = new SetNwSrcActionBuilder();
         val inetAddress = sourceAction.address;
         address = inetAddress.toInetAddress;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetNwSrcActionCaseBuilder().setSetNwSrcAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -268,7 +291,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetNwTosActionBuilder();
         tos = sourceAction.nwTos;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetNwTosActionCaseBuilder().setSetNwTosAction(it.build).build;
         return actionBuilder.build();
     }
 
@@ -276,7 +299,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetTpDstActionBuilder();
         port = new PortNumber(sourceAction.port);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetTpDstActionCaseBuilder().setSetTpDstAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -284,7 +307,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetTpSrcActionBuilder();
         port = new PortNumber(sourceAction.port);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetTpSrcActionCaseBuilder().setSetTpSrcAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -292,7 +315,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetVlanCfiActionBuilder();
         vlanCfi = new VlanCfi(sourceAction.cfi);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -301,7 +324,7 @@ public class MDFlowMapping {
 
         val it = new SetVlanIdActionBuilder();
         vlanId = new VlanId(sourceAction.vlanId);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetVlanIdActionCaseBuilder().setSetVlanIdAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -309,13 +332,13 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetVlanPcpActionBuilder();
         vlanPcp = new VlanPcp(sourceAction.pcp as short);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(it.build).build;
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(SwPath sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new SwPathActionBuilder().build();
+        actionBuilder.action = new SwPathActionCaseBuilder().setSwPathAction(new SwPathActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
index b5ed3fe..a8349be 100644 (file)
@@ -35,38 +35,39 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.ActionList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
@@ -147,8 +148,8 @@ public class ToSalConversionsUtils {
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source) {
         if (source.getInstructions() != null) {
             for (Instruction instruction : source.getInstructions().getInstruction()) {
-                if (instruction.getInstruction() instanceof ActionList) {
-                    return (((ActionList) instruction.getInstruction()).getAction());
+                if (instruction.getInstruction() instanceof ApplyActionsCase) {
+                    return (((ApplyActionsCase) instruction.getInstruction()).getApplyActions().getAction());
                 }
             }
         }
@@ -162,119 +163,119 @@ public class ToSalConversionsUtils {
                org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action sourceAction = action
                     .getAction();
 
-            if (sourceAction instanceof ControllerAction) {
+            if (sourceAction instanceof ControllerActionCase) {
                 targetAction.add(new Controller());
-            } else if (sourceAction instanceof OutputAction) {
+            } else if (sourceAction instanceof OutputActionCase) {
 
-                Uri nodeConnector = ((OutputAction) sourceAction).getOutputNodeConnector();
+                Uri nodeConnector = ((OutputActionCase) sourceAction).getOutputAction().getOutputNodeConnector();
                 if (nodeConnector != null) {
                     //for (Uri uri : nodeConnectors) {
                         targetAction.add(new Output(fromNodeConnectorRef(nodeConnector)));
                     //}
                 }
-            } else if (sourceAction instanceof PopMplsAction) {
+            } else if (sourceAction instanceof PopMplsActionCase) {
                 // TODO: define maping
-            } else if (sourceAction instanceof PushMplsAction) {
+            } else if (sourceAction instanceof PushMplsActionCase) {
                 // TODO: define maping
-            } else if (sourceAction instanceof PushPbbAction) {
+            } else if (sourceAction instanceof PushPbbActionCase) {
                 // TODO: define maping
-            } else if (sourceAction instanceof SetMplsTtlAction) {
+            } else if (sourceAction instanceof SetMplsTtlActionCase) {
                 // TODO: define maping
                 // targetAction = //no action to map
-            } else if (sourceAction instanceof SetNwTtlAction) {
+            } else if (sourceAction instanceof SetNwTtlActionCase) {
                 // TODO: define maping
-            } else if (sourceAction instanceof SetQueueAction) {
+            } else if (sourceAction instanceof SetQueueActionCase) {
                 // TODO: define maping
                 // targetAction = //no action to map
-            } else if (sourceAction instanceof DropAction) {
+            } else if (sourceAction instanceof DropActionCase) {
                 targetAction.add(new Drop());
-            } else if (sourceAction instanceof FloodAction) {
+            } else if (sourceAction instanceof FloodActionCase) {
                 targetAction.add(new Flood());
-            } else if (sourceAction instanceof FloodAllAction) {
+            } else if (sourceAction instanceof FloodAllActionCase) {
                 targetAction.add(new FloodAll());
-            } else if (sourceAction instanceof HwPathAction) {
+            } else if (sourceAction instanceof HwPathActionCase) {
                 targetAction.add(new HwPath());
-            } else if (sourceAction instanceof LoopbackAction) {
+            } else if (sourceAction instanceof LoopbackActionCase) {
                 targetAction.add(new Loopback());
-            } else if (sourceAction instanceof PopVlanAction) {
+            } else if (sourceAction instanceof PopVlanActionCase) {
                 targetAction.add(new PopVlan());
-            } else if (sourceAction instanceof PushVlanAction) {
-                PushVlanAction pushVlanAction = (PushVlanAction) sourceAction;
-                PushVlan pushVlan = pushVlanFrom(pushVlanAction);
+            } else if (sourceAction instanceof PushVlanActionCase) {
+                PushVlanActionCase pushVlanAction = (PushVlanActionCase) sourceAction;
+                PushVlan pushVlan = pushVlanFrom(pushVlanAction.getPushVlanAction());
                 if (pushVlan != null) {
                     targetAction.add(pushVlan);
                 }
-            } else if (sourceAction instanceof SetDlDstAction) {
-                MacAddress addressL2Dest = ((SetDlDstAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetDlDstActionCase) {
+                MacAddress addressL2Dest = ((SetDlDstActionCase) sourceAction).getSetDlDstAction().getAddress();
                 if (addressL2Dest != null) {
                     targetAction.add(new SetDlDst(bytesFrom(addressL2Dest)));
                 }
-            } else if (sourceAction instanceof SetDlSrcAction) {
-                MacAddress addressL2Src = ((SetDlSrcAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetDlSrcActionCase) {
+                MacAddress addressL2Src = ((SetDlSrcActionCase) sourceAction).getSetDlSrcAction().getAddress();
                 if (addressL2Src != null) {
                     targetAction.add(new SetDlSrc(bytesFrom(addressL2Src)));
 
                 }
-            } else if (sourceAction instanceof SetDlTypeAction) {
-                EtherType dlType = ((SetDlTypeAction) sourceAction).getDlType();
+            } else if (sourceAction instanceof SetDlTypeActionCase) {
+                EtherType dlType = ((SetDlTypeActionCase) sourceAction).getSetDlTypeAction().getDlType();
                 if (dlType != null) {
                     Long dlTypeValue = dlType.getValue();
                     if (dlTypeValue != null) {
                         targetAction.add(new SetDlType(dlTypeValue.intValue()));
                     }
                 }
-            } else if (sourceAction instanceof SetNextHopAction) {
-                Address addressL3 = ((SetNextHopAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetNextHopActionCase) {
+                Address addressL3 = ((SetNextHopActionCase) sourceAction).getSetNextHopAction().getAddress();
 
                 InetAddress inetAddress = inetAddressFrom(addressL3);
                 if (inetAddress != null) {
                     targetAction.add(new SetNextHop(inetAddress));
                 }
-            } else if (sourceAction instanceof SetNwDstAction) {
-                Address addressL3 = ((SetNwDstAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetNwDstActionCase) {
+                Address addressL3 = ((SetNwDstActionCase) sourceAction).getSetNwDstAction().getAddress();
 
                 InetAddress inetAddress = inetAddressFrom(addressL3);
                 if (inetAddress != null) {
                     targetAction.add(new SetNwDst(inetAddress));
                 }
-            } else if (sourceAction instanceof SetNwSrcAction) {
-                Address addressL3 = ((SetNwSrcAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetNwSrcActionCase) {
+                Address addressL3 = ((SetNwSrcActionCase) sourceAction).getSetNwSrcAction().getAddress();
 
                 InetAddress inetAddress = inetAddressFrom(addressL3);
                 if (inetAddress != null) {
                     targetAction.add(new SetNwSrc(inetAddress));
                 }
-            } else if (sourceAction instanceof SetNwTosAction) {
-                Integer tos = ((SetNwTosAction) sourceAction).getTos();
+            } else if (sourceAction instanceof SetNwTosActionCase) {
+                Integer tos = ((SetNwTosActionCase) sourceAction).getSetNwTosAction().getTos();
                 if (tos != null) {
                     targetAction.add(new SetNwTos(tos));
                 }
-            } else if (sourceAction instanceof SetTpDstAction) {
-                PortNumber port = ((SetTpDstAction) sourceAction).getPort();
+            } else if (sourceAction instanceof SetTpDstActionCase) {
+                PortNumber port = ((SetTpDstActionCase) sourceAction).getSetTpDstAction().getPort();
                 if (port != null) {
                     Integer portValue = port.getValue();
                     if (port.getValue() != null) {
                         targetAction.add(new SetTpDst(portValue));
                     }
                 }
-            } else if (sourceAction instanceof SetTpSrcAction) {
-                PortNumber port = ((SetTpSrcAction) sourceAction).getPort();
+            } else if (sourceAction instanceof SetTpSrcActionCase) {
+                PortNumber port = ((SetTpSrcActionCase) sourceAction).getSetTpSrcAction().getPort();
                 if (port != null) {
                     Integer portValue = port.getValue();
                     if (port.getValue() != null) {
                         targetAction.add(new SetTpSrc(portValue));
                     }
                 }
-            } else if (sourceAction instanceof SetVlanCfiAction) {
-                VlanCfi vlanCfi = ((SetVlanCfiAction) sourceAction).getVlanCfi();
+            } else if (sourceAction instanceof SetVlanCfiActionCase) {
+                VlanCfi vlanCfi = ((SetVlanCfiActionCase) sourceAction).getSetVlanCfiAction().getVlanCfi();
                 if (vlanCfi != null) {
                     Integer vlanCfiValue = vlanCfi.getValue();
                     if (vlanCfiValue != null) {
                         targetAction.add(new SetVlanCfi(vlanCfiValue));
                     }
                 }
-            } else if (sourceAction instanceof SetVlanIdAction) {
-                org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vlanID = ((SetVlanIdAction) sourceAction)
+            } else if (sourceAction instanceof SetVlanIdActionCase) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vlanID = ((SetVlanIdActionCase) sourceAction).getSetVlanIdAction()
                         .getVlanId();
                 if (vlanID != null) {
                     Integer vlanIdValue = vlanID.getValue();
@@ -282,15 +283,15 @@ public class ToSalConversionsUtils {
                         targetAction.add(new SetVlanId(vlanIdValue));
                     }
                 }
-            } else if (sourceAction instanceof SetVlanPcpAction) {
-                VlanPcp vlanPcp = ((SetVlanPcpAction) sourceAction).getVlanPcp();
+            } else if (sourceAction instanceof SetVlanPcpActionCase) {
+                VlanPcp vlanPcp = ((SetVlanPcpActionCase) sourceAction).getSetVlanPcpAction().getVlanPcp();
                 if (vlanPcp != null) {
                     Short vlanPcpValue = vlanPcp.getValue();
                     if (vlanPcpValue != null) {
                         targetAction.add(new SetVlanPcp(vlanPcpValue));
                     }
                 }
-            } else if (sourceAction instanceof SwPathAction) {
+            } else if (sourceAction instanceof SwPathActionCase) {
                 targetAction.add(new SwPath());
             }
         }
@@ -315,7 +316,7 @@ public class ToSalConversionsUtils {
         return null;
     }
 
-    private static PushVlan pushVlanFrom(PushVlanAction pushVlanAction) {
+    private static PushVlan pushVlanFrom(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanAction pushVlanAction) {
         final int tag;
         final int pcp;
         final int cfi;
index cb70174..b062b00 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match;
@@ -186,25 +187,25 @@ public class TestFromSalConversionsUtils {
 
     private void checkOdActions(
             List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions) {
-        checkOdAction(actions, FloodAction.class, false);
-        checkOdAction(actions, FloodAllAction.class, false);
-        checkOdAction(actions, HwPathAction.class, false);
-        checkOdAction(actions, LoopbackAction.class, false);
-        checkOdAction(actions, PopVlanAction.class, false);
-        checkOdAction(actions, PushVlanAction.class, true);
-        checkOdAction(actions, SetDlDstAction.class, true);
-        checkOdAction(actions, SetDlSrcAction.class, true);
-        checkOdAction(actions, SetDlTypeAction.class, true);
-        checkOdAction(actions, SetNwTosAction.class, true);
-        checkOdAction(actions, SetNwDstAction.class, true);
-        checkOdAction(actions, SetNwSrcAction.class, true);
-        checkOdAction(actions, SetNextHopAction.class, true);
-        checkOdAction(actions, SetTpDstAction.class, true);
-        checkOdAction(actions, SetTpSrcAction.class, true);
-        checkOdAction(actions, SetVlanCfiAction.class, true);
-        checkOdAction(actions, SetVlanIdAction.class, true);
-        checkOdAction(actions, SetVlanPcpAction.class, true);
-        checkOdAction(actions, SwPathAction.class, false);
+        checkOdAction(actions, FloodActionCase.class, false);
+        checkOdAction(actions, FloodAllActionCase.class, false);
+        checkOdAction(actions, HwPathActionCase.class, false);
+        checkOdAction(actions, LoopbackActionCase.class, false);
+        checkOdAction(actions, PopVlanActionCase.class, false);
+        checkOdAction(actions, PushVlanActionCase.class, true);
+        checkOdAction(actions, SetDlDstActionCase.class, true);
+        checkOdAction(actions, SetDlSrcActionCase.class, true);
+        checkOdAction(actions, SetDlTypeActionCase.class, true);
+        checkOdAction(actions, SetNwTosActionCase.class, true);
+        checkOdAction(actions, SetNwDstActionCase.class, true);
+        checkOdAction(actions, SetNwSrcActionCase.class, true);
+        checkOdAction(actions, SetNextHopActionCase.class, true);
+        checkOdAction(actions, SetTpDstActionCase.class, true);
+        checkOdAction(actions, SetTpSrcActionCase.class, true);
+        checkOdAction(actions, SetVlanCfiActionCase.class, true);
+        checkOdAction(actions, SetVlanIdActionCase.class, true);
+        checkOdAction(actions, SetVlanPcpActionCase.class, true);
+        checkOdAction(actions, SwPathActionCase.class, false);
     }
 
     private void checkOdAction(
@@ -216,26 +217,26 @@ public class TestFromSalConversionsUtils {
                     .getAction();
             if (cl.isInstance(innerAction)) {
                 numOfFoundActions++;
-                if (innerAction instanceof PushVlanAction) {
-                    assertEquals("Wrong value of cfi in PushVlanAction.", (Integer) 1, ((PushVlanAction) innerAction)
+                if (innerAction instanceof PushVlanActionCase) {
+                    assertEquals("Wrong value of cfi in PushVlanAction.", (Integer) 1, ((PushVlanActionCase) innerAction).getPushVlanAction()
                             .getCfi().getValue());
                     assertEquals("Wrong value of pcp in PushVlanAction.", (Integer) 7,
-                            ((PushVlanAction) innerAction).getPcp());
+                            ((PushVlanActionCase) innerAction).getPushVlanAction().getPcp());
                     assertEquals("Wrong value of tag in PushVlanAction.", (Integer) 0x8100,
-                            ((PushVlanAction) innerAction).getTag());
+                            ((PushVlanActionCase) innerAction).getPushVlanAction().getTag());
                     assertEquals("Wrong value of vlad ID in PushVlanAction.", (Integer) 4095,
-                            ((PushVlanAction) innerAction).getVlanId().getValue());
-                } else if (innerAction instanceof SetDlDstAction) {
+                            ((PushVlanActionCase) innerAction).getPushVlanAction().getVlanId().getValue());
+                } else if (innerAction instanceof SetDlDstActionCase) {
                     assertEquals("Wrong MAC destination address in SetDlDstAction.", "ff:ee:dd:cc:bb:aa", 
-                            ((SetDlDstAction) innerAction).getAddress().getValue());
-                } else if (innerAction instanceof SetDlSrcAction) {
+                            ((SetDlDstActionCase) innerAction).getSetDlDstAction().getAddress().getValue());
+                } else if (innerAction instanceof SetDlSrcActionCase) {
                     assertEquals("Wrong MAC source address in SetDlDstAction.", "ff:ee:dd:cc:bb:aa", 
-                            ((SetDlSrcAction) innerAction).getAddress().getValue());
-                } else if (innerAction instanceof SetDlTypeAction) {
+                            ((SetDlSrcActionCase) innerAction).getSetDlSrcAction().getAddress().getValue());
+                } else if (innerAction instanceof SetDlTypeActionCase) {
                     assertEquals("Wrong data link type in SetDlTypeAction.", (long) 513,
-                            (long) ((SetDlTypeAction) innerAction).getDlType().getValue());
-                } else if (innerAction instanceof SetNextHopAction) {
-                    Address address = ((SetNextHopAction) innerAction).getAddress();
+                            (long) ((SetDlTypeActionCase) innerAction).getSetDlTypeAction().getDlType().getValue());
+                } else if (innerAction instanceof SetNextHopActionCase) {
+                    Address address = ((SetNextHopActionCase) innerAction).getSetNextHopAction().getAddress();
                     boolean ipv4AddressFound = false;
                     if (address instanceof Ipv4) {
                         ipv4AddressFound = true;
@@ -243,10 +244,10 @@ public class TestFromSalConversionsUtils {
                                 .getIpv4Address().getValue());
                     }
                     assertTrue("Ipv4 address wasn't found.", ipv4AddressFound);
-                } else if (innerAction instanceof SetNwTosAction) {
-                    assertEquals("Wrong TOS in SetNwTosAction.", (Integer) 63, ((SetNwTosAction) innerAction).getTos());
-                } else if (innerAction instanceof SetNwDstAction) {
-                    Address address = ((SetNwDstAction) innerAction).getAddress();
+                } else if (innerAction instanceof SetNwTosActionCase) {
+                    assertEquals("Wrong TOS in SetNwTosAction.", (Integer) 63, ((SetNwTosActionCase) innerAction).getSetNwTosAction().getTos());
+                } else if (innerAction instanceof SetNwDstActionCase) {
+                    Address address = ((SetNwDstActionCase) innerAction).getSetNwDstAction().getAddress();
                     boolean ipv4AddressFound = false;
                     if (address instanceof Ipv4) {
                         ipv4AddressFound = true;
@@ -254,8 +255,8 @@ public class TestFromSalConversionsUtils {
                                 .getIpv4Address().getValue());
                     }
                     assertTrue("Ipv4 address wasn't found.", ipv4AddressFound);
-                } else if (innerAction instanceof SetNwSrcAction) {
-                    Address address = ((SetNwSrcAction) innerAction).getAddress();
+                } else if (innerAction instanceof SetNwSrcActionCase) {
+                    Address address = ((SetNwSrcActionCase) innerAction).getSetNwSrcAction().getAddress();
                     boolean ipv4AddressFound = false;
                     if (address instanceof Ipv4) {
                         ipv4AddressFound = true;
@@ -263,21 +264,21 @@ public class TestFromSalConversionsUtils {
                                 .getIpv4Address().getValue());
                     }
                     assertTrue("Ipv4 address wasn't found.", ipv4AddressFound);
-                } else if (innerAction instanceof SetTpDstAction) {
+                } else if (innerAction instanceof SetTpDstActionCase) {
                     assertEquals("Port number is incorrect in SetTpDstAction.", (Integer) 65534,
-                            ((SetTpDstAction) innerAction).getPort().getValue());
-                } else if (innerAction instanceof SetTpSrcAction) {
+                            ((SetTpDstActionCase) innerAction).getSetTpDstAction().getPort().getValue());
+                } else if (innerAction instanceof SetTpSrcActionCase) {
                     assertEquals("Port number is incorrect in SetTpSrcAction.", (Integer) 65535,
-                            ((SetTpSrcAction) innerAction).getPort().getValue());
-                } else if (innerAction instanceof SetVlanCfiAction) {
+                            ((SetTpSrcActionCase) innerAction).getSetTpSrcAction().getPort().getValue());
+                } else if (innerAction instanceof SetVlanCfiActionCase) {
                     assertEquals("Vlan cfi number is incorrect in SetVlanCfiAction.", (Integer) 1,
-                            ((SetVlanCfiAction) innerAction).getVlanCfi().getValue());
-                } else if (innerAction instanceof SetVlanIdAction) {
+                            ((SetVlanCfiActionCase) innerAction).getSetVlanCfiAction().getVlanCfi().getValue());
+                } else if (innerAction instanceof SetVlanIdActionCase) {
                     assertEquals("Vlan id number is incorrect in SetVlanIdAction.", (Integer) 4095,
-                            ((SetVlanIdAction) innerAction).getVlanId().getValue());
-                } else if (innerAction instanceof SetVlanPcpAction) {
+                            ((SetVlanIdActionCase) innerAction).getSetVlanIdAction().getVlanId().getValue());
+                } else if (innerAction instanceof SetVlanPcpActionCase) {
                     assertEquals("Vlan pcp number is incorrect in SetVlanPcpAction.", new Short((short) 7),
-                            ((SetVlanPcpAction) innerAction).getVlanPcp().getValue());
+                            ((SetVlanPcpActionCase) innerAction).getSetVlanPcpAction().getVlanPcp().getValue());
                 }
             }
         }
index 97e1660..793f3cc 100644 (file)
@@ -29,6 +29,34 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.Flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;
@@ -54,8 +82,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
 
 import com.google.common.net.InetAddresses;
 
@@ -282,31 +311,31 @@ public class TestToSalConversionsUtils {
     private Instructions prepareOdActions() {
         List<Action> odActions = new ArrayList<>();
 
-        ControllerActionBuilder controllerActionBuilder = new ControllerActionBuilder();
-        DropActionBuilder dropActionBuilder = new DropActionBuilder();
-        FloodActionBuilder floodActionBuilder = new FloodActionBuilder();
-        FloodAllActionBuilder floodAllActionBuilder = new FloodAllActionBuilder();
-        HwPathActionBuilder hwPathActionBuilder = new HwPathActionBuilder();
-        LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
-        OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
-        PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
-        PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
-        PushMplsActionBuilder pushMplsActionBuilder = new PushMplsActionBuilder();
-        PushPbbActionBuilder pushPbbActionBuilder = new PushPbbActionBuilder();
-        PushVlanActionBuilder pushVlanActionBuilder = new PushVlanActionBuilder();
-        SetDlDstActionBuilder setDlDstActionBuilder = new SetDlDstActionBuilder();
-        SetDlSrcActionBuilder setDlSrcActionBuilder = new SetDlSrcActionBuilder();
-        SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
-        SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
-        SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
-        SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
-        SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
-        SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
-        SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
-        SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
-        SetVlanIdActionBuilder setVlanIdActionBuilder = new SetVlanIdActionBuilder();
-        SetVlanPcpActionBuilder setVlanPcpActionBuilder = new SetVlanPcpActionBuilder();
-        SwPathActionBuilder swPathActionBuilder = new SwPathActionBuilder();
+        ControllerActionCaseBuilder controllerActionBuilder = new ControllerActionCaseBuilder();
+        DropActionCaseBuilder dropActionBuilder = new DropActionCaseBuilder();
+        FloodActionCaseBuilder floodActionBuilder = new FloodActionCaseBuilder();
+        FloodAllActionCaseBuilder floodAllActionBuilder = new FloodAllActionCaseBuilder();
+        HwPathActionCaseBuilder hwPathActionBuilder = new HwPathActionCaseBuilder();
+        LoopbackActionCaseBuilder loopbackActionBuilder = new LoopbackActionCaseBuilder();
+        OutputActionCaseBuilder outputActionBuilder = new OutputActionCaseBuilder();
+        PopMplsActionCaseBuilder popMplsActionBuilder = new PopMplsActionCaseBuilder();
+        PopVlanActionCaseBuilder popVlanActionBuilder = new PopVlanActionCaseBuilder();
+        PushMplsActionCaseBuilder pushMplsActionBuilder = new PushMplsActionCaseBuilder();
+        PushPbbActionCaseBuilder pushPbbActionBuilder = new PushPbbActionCaseBuilder();
+        PushVlanActionCaseBuilder pushVlanActionBuilder = new PushVlanActionCaseBuilder();
+        SetDlDstActionCaseBuilder setDlDstActionBuilder = new SetDlDstActionCaseBuilder();
+        SetDlSrcActionCaseBuilder setDlSrcActionBuilder = new SetDlSrcActionCaseBuilder();
+        SetDlTypeActionCaseBuilder setDlTypeActionBuilder = new SetDlTypeActionCaseBuilder();
+        SetMplsTtlActionCaseBuilder setMplsTtlActionBuilder = new SetMplsTtlActionCaseBuilder();
+        SetNwTosActionCaseBuilder setNwTosActionBuilder = new SetNwTosActionCaseBuilder();
+        SetNwTtlActionCaseBuilder setNwTtlActionBuilder = new SetNwTtlActionCaseBuilder();
+        SetQueueActionCaseBuilder setQueueActionBuilder = new SetQueueActionCaseBuilder();
+        SetTpDstActionCaseBuilder setTpDstActionBuilder = new SetTpDstActionCaseBuilder();
+        SetTpSrcActionCaseBuilder setTpSrcActionBuilder = new SetTpSrcActionCaseBuilder();
+        SetVlanCfiActionCaseBuilder setVlanCfiActionBuilder = new SetVlanCfiActionCaseBuilder();
+        SetVlanIdActionCaseBuilder setVlanIdActionBuilder = new SetVlanIdActionCaseBuilder();
+        SetVlanPcpActionCaseBuilder setVlanPcpActionBuilder = new SetVlanPcpActionCaseBuilder();
+        SwPathActionCaseBuilder swPathActionBuilder = new SwPathActionCaseBuilder();
 
         prepareActionOutput(outputActionBuilder);
         prepareActionPushVlan(pushVlanActionBuilder);
@@ -350,7 +379,7 @@ public class TestToSalConversionsUtils {
         odActions.add(new ActionBuilder().setAction(swPathActionBuilder.build()).build());
 
         
-        ApplyActions innerInst = new ApplyActionsBuilder().setAction(odActions).build();
+        ApplyActionsCase innerInst = new ApplyActionsCaseBuilder().setApplyActions(new ApplyActionsBuilder().setAction(odActions).build()).build();
         Instruction applyActions = new InstructionBuilder().setInstruction(innerInst).build();
         List<Instruction> instructions = Collections.singletonList(applyActions );
         InstructionsBuilder instBuilder = new InstructionsBuilder();
@@ -360,64 +389,77 @@ public class TestToSalConversionsUtils {
         return instBuilder.build();
     }
 
-    private void prepareActionSetVlanPcp(SetVlanPcpActionBuilder setVlanPcpActionBuilder) {
+    private void prepareActionSetVlanPcp(SetVlanPcpActionCaseBuilder wrapper) {
+        SetVlanPcpActionBuilder setVlanPcpActionBuilder = new SetVlanPcpActionBuilder();
         setVlanPcpActionBuilder.setVlanPcp(new VlanPcp((short) 7));
+        wrapper.setSetVlanPcpAction(setVlanPcpActionBuilder.build());
     }
 
-    private void prepareActionSetVladId(SetVlanIdActionBuilder setVlanIdActionBuilder) {
+    private void prepareActionSetVladId(SetVlanIdActionCaseBuilder wrapper) {
+        SetVlanIdActionBuilder setVlanIdActionBuilder = new SetVlanIdActionBuilder();
         setVlanIdActionBuilder.setVlanId(new VlanId(4095));
+        wrapper.setSetVlanIdAction(setVlanIdActionBuilder.build());
     }
 
-    private void prepareActionSetVlanCfi(SetVlanCfiActionBuilder setVlanCfiActionBuilder) {
+    private void prepareActionSetVlanCfi(SetVlanCfiActionCaseBuilder wrapper) {
+        SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
         setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(1));
+        wrapper.setSetVlanCfiAction(setVlanCfiActionBuilder.build());
     }
 
-    private void prepareActionSetTpDst(SetTpDstActionBuilder setTpDstActionBuilder) {
+    private void prepareActionSetTpDst(SetTpDstActionCaseBuilder wrapper) {
+        SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
         setTpDstActionBuilder.setPort(new PortNumber(65535));
+        wrapper.setSetTpDstAction(setTpDstActionBuilder.build());
     }
 
-    private void prepareActionSetTpSrc(SetTpSrcActionBuilder setTpSrcActionBuilder) {
+    private void prepareActionSetTpSrc(SetTpSrcActionCaseBuilder wrapper) {
+        SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
         setTpSrcActionBuilder.setPort(new PortNumber(65535));
+        wrapper.setSetTpSrcAction(setTpSrcActionBuilder.build());
     }
 
-    private void prepareActionSetNwTos(SetNwTosActionBuilder setNwTosActionBuilder) {
+    private void prepareActionSetNwTos(SetNwTosActionCaseBuilder wrapper) {
+        SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
         setNwTosActionBuilder.setTos(63);
+        wrapper.setSetNwTosAction(setNwTosActionBuilder.build());
     }
 
     private void prepareActionSetNwSrc(List<Action> odActions) {
         // test case for IPv4
         SetNwSrcActionBuilder setNwSrcActionBuilderIpv4 = new SetNwSrcActionBuilder();
         setNwSrcActionBuilderIpv4.setAddress(prapareIpv4Address("192.168.100.102"));
-        odActions.add(new ActionBuilder().setAction(setNwSrcActionBuilderIpv4.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwSrcActionBuilderIpv4.build()).build()).build());
 
         // test case for IPv6
         SetNwSrcActionBuilder setNwSrcActionBuilderIpv6 = new SetNwSrcActionBuilder();
         setNwSrcActionBuilderIpv6.setAddress(prapareIpv6Address("2001:0db8:85a3:0000:0000:8a2e:0370:7336"));
-        odActions.add(new ActionBuilder().setAction(setNwSrcActionBuilderIpv6.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwSrcActionBuilderIpv6.build()).build()).build());
     }
 
     private void prepareActionSetNwDst(List<Action> odActions) {
         // test case for IPv4
+        
         SetNwDstActionBuilder setNwDstActionBuilderIpv4 = new SetNwDstActionBuilder();
         setNwDstActionBuilderIpv4.setAddress(prapareIpv4Address("192.168.100.101"));
-        odActions.add(new ActionBuilder().setAction(setNwDstActionBuilderIpv4.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilderIpv4.build()).build()).build());
 
         // test case for IPv6
         SetNwDstActionBuilder setNwDstActionBuilderIpv6 = new SetNwDstActionBuilder();
         setNwDstActionBuilderIpv6.setAddress(prapareIpv6Address("2001:0db8:85a3:0000:0000:8a2e:0370:7335"));
-        odActions.add(new ActionBuilder().setAction(setNwDstActionBuilderIpv6.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilderIpv6.build()).build()).build());
     }
 
     private void prepareActionNextHop(List<Action> odActions) {
         // test case for IPv4
         SetNextHopActionBuilder setNextHopActionBuilderIpv4 = new SetNextHopActionBuilder();
         setNextHopActionBuilderIpv4.setAddress(prapareIpv4Address("192.168.100.100"));
-        odActions.add(new ActionBuilder().setAction(setNextHopActionBuilderIpv4.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilderIpv4.build()).build()).build());
 
         // test case for IPv6
         SetNextHopActionBuilder setNextHopActionBuilderIpv6 = new SetNextHopActionBuilder();
         setNextHopActionBuilderIpv6.setAddress(prapareIpv6Address("2001:0db8:85a3:0000:0000:8a2e:0370:7334"));
-        odActions.add(new ActionBuilder().setAction(setNextHopActionBuilderIpv6.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilderIpv6.build()).build()).build());
     }
 
     private Address prapareIpv4Address(String ipv4Address) {
@@ -432,27 +474,37 @@ public class TestToSalConversionsUtils {
         return ipv6Builder.build();
     }
 
-    private void prepareActionSetDlType(SetDlTypeActionBuilder setDlTypeActionBuilder) {
+    private void prepareActionSetDlType(SetDlTypeActionCaseBuilder wrapper) {
+        SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
         setDlTypeActionBuilder.setDlType(new EtherType(513l));
+        wrapper.setSetDlTypeAction(setDlTypeActionBuilder.build());
     }
 
-    private void prepareActionSetDlSrc(SetDlSrcActionBuilder setDlSrcActionBuilder) {
+    private void prepareActionSetDlSrc(SetDlSrcActionCaseBuilder wrapper) {
+        SetDlSrcActionBuilder setDlSrcActionBuilder = new SetDlSrcActionBuilder();
         setDlSrcActionBuilder.setAddress(new MacAddress("24:77:03:7C:C5:F1"));
+        wrapper.setSetDlSrcAction(setDlSrcActionBuilder.build());
     }
 
-    private void prepareActionSetDlDst(SetDlDstActionBuilder setDlDstActionBuilder) {
+    private void prepareActionSetDlDst(SetDlDstActionCaseBuilder wrapper) {
+        SetDlDstActionBuilder setDlDstActionBuilder = new SetDlDstActionBuilder();
         setDlDstActionBuilder.setAddress(new MacAddress("3C:A9:F4:00:E0:C8"));
+        wrapper.setSetDlDstAction(setDlDstActionBuilder.build());
     }
 
-    private void prepareActionPushVlan(PushVlanActionBuilder pushVlanActionBuilder) {
+    private void prepareActionPushVlan(PushVlanActionCaseBuilder wrapper) {
+        PushVlanActionBuilder pushVlanActionBuilder = new PushVlanActionBuilder();
         pushVlanActionBuilder.setPcp(7); // 3 bits
         pushVlanActionBuilder.setCfi(new VlanCfi(1)); // 1 bit
         pushVlanActionBuilder.setVlanId(new VlanId(4095));
         pushVlanActionBuilder.setTag(0x8100); // 12 bit
+        wrapper.setPushVlanAction(pushVlanActionBuilder.build());
     }
 
-    private void prepareActionOutput(OutputActionBuilder outputActionBuilder) {       
+    private void prepareActionOutput(OutputActionCaseBuilder wrapper) {
+        OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
         outputActionBuilder.setOutputNodeConnector(new Uri("uri1"));
+        wrapper.setOutputAction(outputActionBuilder.build());
     }
 
     private Match prepOdMatch(MtchType mt) {
index 597483e..e2948fd 100644 (file)
@@ -23,7 +23,7 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Bundle-Activator>org.opendaylight.controller.forwardingrulesmanager.consumer.impl.FRMConsumerImpl</Bundle-Activator>
+                        <Bundle-Activator>org.opendaylight.controller.frm.FRMActivator</Bundle-Activator>
                     </instructions>
                 </configuration>
             </plugin>
index 24bfc4f..ab2e19e 100644 (file)
@@ -11,29 +11,23 @@ import org.opendaylight.controller.sal.utils.NetUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.Meter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatch;
@@ -43,6 +37,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 
 public class FRMUtil {
     protected static final Logger logger = LoggerFactory.getLogger(FRMUtil.class);
@@ -207,15 +208,15 @@ public class FRMUtil {
         for (Action curaction : actions) {
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = curaction
                     .getAction();
-            if (action instanceof ControllerAction) {
-                Integer length = ((ControllerAction) action).getMaxLength();
+            if (action instanceof ControllerActionCase) {
+                Integer length = ((ControllerActionCase) action).getControllerAction().getMaxLength();
                 if (length < 0 || length > 65294) {
                     logger.error("Controller: MaxLength is not valid");
                     return false;
                 }
-            } else if (action instanceof OutputAction) {
-                Integer length = ((OutputAction) action).getMaxLength();
-                Uri outputnodeconnector = ((OutputAction) action).getOutputNodeConnector();
+            } else if (action instanceof OutputActionCase) {
+                Integer length = ((OutputActionCase) action).getOutputAction().getMaxLength();
+                Uri outputnodeconnector = ((OutputActionCase) action).getOutputAction().getOutputNodeConnector();
                 if (length < 0 || length > 65294) {
                     logger.error("OutputAction: MaxLength is not valid");
                     return false;
@@ -240,62 +241,62 @@ public class FRMUtil {
                     }
 
                 }
-            } else if (action instanceof PushMplsAction) {
-                Integer ethertype = ((PushMplsAction) action).getEthernetType();
+            } else if (action instanceof PushMplsActionCase) {
+                Integer ethertype = ((PushMplsActionCase) action).getPushMplsAction().getEthernetType();
                 if (ethertype != null && ethertype != 0x8847 && ethertype != 0x8848) {
                     logger.error("Ether Type is not valid for PushMplsAction");
                     return false;
                 }
-            } else if (action instanceof PushPbbAction) {
-                Integer ethertype = ((PushPbbAction) action).getEthernetType();
+            } else if (action instanceof PushPbbActionCase) {
+                Integer ethertype = ((PushPbbActionCase) action).getPushPbbAction().getEthernetType();
                 if (ethertype != null && ethertype != 0x88E7) {
                     logger.error("Ether type is not valid for PushPbbAction");
                     return false;
                 }
-            } else if (action instanceof PushVlanAction) {
-                Integer ethertype = ((PushVlanAction) action).getEthernetType();
+            } else if (action instanceof PushVlanActionCase) {
+                Integer ethertype = ((PushVlanActionCase) action).getPushVlanAction().getEthernetType();
                 if (ethertype != null && ethertype != 0x8100 && ethertype != 0x88a8) {
                     logger.error("Ether Type is not valid for PushVlanAction");
                     return false;
                 }
-            } else if (action instanceof SetDlDstAction) {
-                MacAddress address = ((SetDlDstAction) action).getAddress();
-                if (address != null && !isL2AddressValid(address.toString())) {
+            } else if (action instanceof SetDlDstActionCase || action instanceof SetDlSrcActionCase) {
+                MacAddress address = ((SetDlDstActionCase) action).getSetDlDstAction().getAddress();
+                if (address != null && !isL2AddressValid(address.getValue())) {
                     logger.error("SetDlDstAction: Address not valid");
                     return false;
                 }
-            } else if (action instanceof SetDlSrcAction) {
-                MacAddress address = ((SetDlSrcAction) action).getAddress();
-                if (address != null && !isL2AddressValid(address.toString())) {
+            } else if (action instanceof SetDlSrcActionCase) {
+                MacAddress address = ((SetDlSrcActionCase) action).getSetDlSrcAction().getAddress();
+                if (address != null && !isL2AddressValid(address.getValue())) {
                     logger.error("SetDlSrcAction: Address not valid");
                     return false;
                 }
-            } else if (action instanceof SetQueueAction) {
-                String queue = ((SetQueueAction) action).getQueue();
+            } else if (action instanceof SetQueueActionCase) {
+                String queue = ((SetQueueActionCase) action).getSetQueueAction().getQueue();
                 if (queue != null && !isQueueValid(queue)) {
                     logger.error("Queue Id not valid");
                     return false;
                 }
-            } else if (action instanceof SetTpDstAction) {
-                PortNumber port = ((SetTpDstAction) action).getPort();
+            } else if (action instanceof SetTpDstActionCase) {
+                PortNumber port = ((SetTpDstActionCase) action).getSetTpDstAction().getPort();
                 if (port != null && !isPortValid(port)) {
                     logger.error("Port not valid");
                 }
-            } else if (action instanceof SetTpSrcAction) {
-                PortNumber port = ((SetTpSrcAction) action).getPort();
+            } else if (action instanceof SetTpSrcActionCase) {
+                PortNumber port = ((SetTpSrcActionCase) action).getSetTpSrcAction().getPort();
                 if (port != null && !isPortValid(port)) {
                     logger.error("Port not valid");
                 }
-            } else if (action instanceof SetVlanIdAction) {
-                VlanId vlanid = ((SetVlanIdAction) action).getVlanId();
-                if (vlanid != null && !isVlanIdValid(vlanid.getValue().toString())) {
-                    logger.error("Vlan ID is not in the range 0 - 4095");
+            } else if (action instanceof SetVlanIdActionCase) {
+                VlanId vlanid = ((SetVlanIdActionCase) action).getSetVlanIdAction().getVlanId();
+                if (vlanid != null && !isVlanIdValid(vlanid.toString())) {
+                    logger.error("Vlan ID %s is not in the range 0 - 4095");
                     return false;
                 }
-            } else if (action instanceof SetVlanPcpAction) {
-                VlanPcp vlanpcp = ((SetVlanPcpAction) action).getVlanPcp();
-                if (vlanpcp != null && !isVlanPriorityValid(vlanpcp.getValue().toString())) {
-                    logger.error("Vlan priority is not in the range 0 - 7");
+            } else if (action instanceof SetVlanPcpActionCase) {
+                VlanPcp vlanpcp = ((SetVlanPcpActionCase) action).getSetVlanPcpAction().getVlanPcp();
+                if (vlanpcp != null && !isVlanPriorityValid(vlanpcp.toString())) {
+                    logger.error("Vlan priority %s is not in the range 0 - 7");
                     return false;
                 }
             }
@@ -315,35 +316,35 @@ public class FRMUtil {
         for (Instruction instruction : instructionsList) {
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction
                     .getInstruction();
-            if (curInstruction instanceof GoToTable) {
+            if (curInstruction instanceof GoToTableCase) {
 
-                Short tableid = ((GoToTable) curInstruction).getTableId();
+                Short tableid = ((GoToTableCase) curInstruction).getGoToTable().getTableId();
                 if (tableid < 0) {
                     logger.error("table id is not valid");
                     return false;
                 }
             }
 
-            else if (curInstruction instanceof WriteActions) {
+            else if (curInstruction instanceof WriteActionsCase) {
 
-                List<Action> action = ((WriteActions) curInstruction).getAction();
+                List<Action> action = ((WriteActionsCase) curInstruction).getWriteActions().getAction();
                 validateActions(action);
 
             }
 
-            else if (curInstruction instanceof ApplyActions) {
-                List<Action> action = ((ApplyActions) curInstruction).getAction();
+            else if (curInstruction instanceof ApplyActionsCase) {
+                List<Action> action = ((ApplyActionsCase) curInstruction).getApplyActions().getAction();
                 validateActions(action);
             }
 
-            else if (curInstruction instanceof ClearActions) {
-                List<Action> action = ((ClearActions) curInstruction).getAction();
+            else if (curInstruction instanceof ClearActionsCase) {
+                List<Action> action = ((ClearActionsCase) curInstruction).getClearActions().getAction();
                 validateActions(action);
             }
 
-            else if (curInstruction instanceof Meter) {
+            else if (curInstruction instanceof MeterCase) {
 
-                String meter = ((Meter) curInstruction).getMeter();
+                MeterId meter = ((MeterCase) curInstruction).getMeter().getMeterId();
                 if (meter != null && !isValidMeter(meter)) {
                     logger.error("Meter Id is not valid");
                     return false;
@@ -355,7 +356,7 @@ public class FRMUtil {
         return true;
     }
 
-    public static boolean isValidMeter(String meter) {
+    public static boolean isValidMeter(MeterId meter) {
         // TODO
         return true;
     }
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend
new file mode 100644 (file)
index 0000000..9f45a11
--- /dev/null
@@ -0,0 +1,99 @@
+package org.opendaylight.controller.frm
+
+import java.util.Collections
+import java.util.HashSet
+import java.util.Map.Entry
+import java.util.Set
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.controller.sal.common.util.Rpcs
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yangtools.yang.common.RpcError
+
+abstract class AbstractTransaction implements DataCommitTransaction<InstanceIdentifier<?extends DataObject>, DataObject> {
+        
+    @Property
+    val DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        _modification = modification;
+    }
+    
+    def void validate() throws IllegalStateException
+    
+    override finish() throws IllegalStateException {
+        validate()
+        callRpcs();
+        return Rpcs.getRpcResult(true, null, Collections.<RpcError>emptySet());     
+    }
+    
+    override getModification() {
+        return _modification;
+    }
+    
+    override rollback() throws IllegalStateException {
+        rollbackRpcs();
+        return Rpcs.getRpcResult(true, null, Collections.<RpcError>emptySet());
+    }
+    
+    def private callRpcs() {
+        val Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> createdEntries = _modification.getCreatedConfigurationData().entrySet();
+
+        /*
+         * This little dance is because updatedEntries contains both created and modified entries
+         * The reason I created a new HashSet is because the collections we are returned are immutable.
+         */
+        val Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> updatedEntries = new HashSet<Entry<InstanceIdentifier<? extends DataObject>, DataObject>>();
+        updatedEntries.addAll(_modification.getUpdatedConfigurationData().entrySet());
+        updatedEntries.removeAll(createdEntries);
+
+        val Set<InstanceIdentifier<? extends DataObject>> removeEntriesInstanceIdentifiers = _modification.getRemovedConfigurationData();
+        for (Entry<InstanceIdentifier<? extends DataObject >, DataObject> entry : createdEntries) {
+            add(entry.key,entry.value);
+        }
+        for (Entry<InstanceIdentifier<?>, DataObject> entry : updatedEntries) {
+                val originalFlow = _modification.originalConfigurationData.get(entry.key);
+                val updatedFlow = entry.value
+                update(entry.key, originalFlow ,updatedFlow);
+        }
+
+        for (InstanceIdentifier<?> instanceId : removeEntriesInstanceIdentifiers ) {
+            val removeValue = _modification.getOriginalConfigurationData.get(instanceId);
+                remove(instanceId,removeValue);
+        }
+    }
+    
+    def void remove(InstanceIdentifier<?> identifier, DataObject remove)
+    
+    def void update(InstanceIdentifier<?> identifier, DataObject original, DataObject update)
+    
+    def void add(InstanceIdentifier<?> identifier, DataObject add)
+    
+    def private rollbackRpcs() {
+        val Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> createdEntries = _modification.getCreatedConfigurationData().entrySet();
+
+        /*
+         * This little dance is because updatedEntries contains both created and modified entries
+         * The reason I created a new HashSet is because the collections we are returned are immutable.
+         */
+        val Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> updatedEntries = new HashSet<Entry<InstanceIdentifier<? extends DataObject>, DataObject>>();
+        updatedEntries.addAll(_modification.getUpdatedConfigurationData().entrySet());
+        updatedEntries.removeAll(createdEntries);
+
+        val Set<InstanceIdentifier<? >> removeEntriesInstanceIdentifiers = _modification.getRemovedConfigurationData();
+        for (Entry<InstanceIdentifier<?>, DataObject> entry : createdEntries) {
+            remove(entry.key,entry.value); // because we are rolling back, remove what we would have added.            
+        }
+        for (Entry<InstanceIdentifier<?>, DataObject> entry : updatedEntries) {
+            val originalFlow = _modification.originalConfigurationData.get(entry.key);
+            val updatedFlow = entry.value
+            update(entry.key, updatedFlow ,originalFlow);// because we are rolling back, replace the updated with the original
+        }
+
+        for (InstanceIdentifier<?> instanceId : removeEntriesInstanceIdentifiers ) {
+            val removeValue = _modification.getOriginalConfigurationData.get(instanceId);
+            add(instanceId,removeValue);// because we are rolling back, add what we would have removed.
+        }
+    }    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FRMActivator.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FRMActivator.xtend
new file mode 100644 (file)
index 0000000..8ec9d79
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013 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
+ */
+package org.opendaylight.controller.frm
+
+import org.opendaylight.controller.frm.flow.FlowProvider
+import org.opendaylight.controller.frm.group.GroupProvider
+import org.opendaylight.controller.frm.meter.MeterProvider
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.osgi.framework.BundleContext
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService
+
+class FRMActivator extends AbstractBindingAwareProvider {
+
+    static var FlowProvider provider = new FlowProvider();
+    static var GroupProvider groupProvider = new GroupProvider();
+    static var MeterProvider meterProvider = new MeterProvider();
+
+    override onSessionInitiated(ProviderContext session) {
+        provider.dataService = session.getSALService(DataProviderService)
+        provider.salFlowService = session.getRpcService(SalFlowService);
+        provider.start();
+        
+        groupProvider.dataService = session.getSALService(DataProviderService)
+        groupProvider.salGroupService = session.getRpcService(SalGroupService)
+        groupProvider.start();
+        
+        meterProvider.dataService = session.getSALService(DataProviderService)
+        meterProvider.salMeterService = session.getRpcService(SalMeterService)
+        meterProvider.start();
+    }
+
+    override protected stopImpl(BundleContext context) {
+        provider.close();
+        groupProvider.close();
+        meterProvider.close();
+    }
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowCommitHandler.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowCommitHandler.xtend
new file mode 100644 (file)
index 0000000..03095fa
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.frm.flow
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+
+class FlowCommitHandler implements DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> {
+       
+    @Property
+    val SalFlowService salFlowService;
+    
+    new(SalFlowService manager) {
+        _salFlowService = manager;
+    }
+    
+    override requestCommit(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        return new FlowTransaction(modification,salFlowService);
+    }
+    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.xtend
new file mode 100644 (file)
index 0000000..e664c7b
--- /dev/null
@@ -0,0 +1,50 @@
+package org.opendaylight.controller.frm.flow
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+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.yangtools.concepts.Registration
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.slf4j.LoggerFactory
+
+class FlowProvider implements AutoCloseable {
+    
+    @Property
+    DataProviderService dataService;
+    
+    @Property
+    SalFlowService salFlowService;
+    
+    FlowCommitHandler commitHandler
+
+    Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>,DataObject>> commitHandlerRegistration;
+    
+    static val LOG = LoggerFactory.getLogger(FlowProvider);
+    
+    def void start() {
+        commitHandler = new FlowCommitHandler(salFlowService)
+        val InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder(Nodes)
+            .child(Node)
+            .augmentation(FlowCapableNode)
+            .child(Table)
+            .child(Flow)
+            .toInstance();
+        commitHandlerRegistration = dataService.registerCommitHandler(path,commitHandler);
+        LOG.info("Flow Config Provider started.");
+    }
+
+    protected def startChange() {
+        return dataService.beginTransaction;
+    }
+    
+    override close() throws Exception {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransaction.xtend
new file mode 100644 (file)
index 0000000..5203d3c
--- /dev/null
@@ -0,0 +1,72 @@
+package org.opendaylight.controller.frm.flow
+
+import org.opendaylight.controller.frm.AbstractTransaction
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+
+class FlowTransaction extends AbstractTransaction {
+    
+    @Property
+    val SalFlowService salFlowService;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalFlowService salFlowService) {
+        super(modification)
+        _salFlowService = salFlowService;
+    }
+    
+    override remove(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Flow) {
+            val flow = (obj as Flow)
+            val tableInstanceId = instanceId.firstIdentifierOf(Table);
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new RemoveFlowInputBuilder(flow);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setFlowTable(new FlowTableRef(tableInstanceId));
+            _salFlowService.removeFlow(builder.build());            
+        }
+    }
+    
+    override update(InstanceIdentifier<?> instanceId, DataObject originalObj, DataObject updatedObj) {
+        if(originalObj instanceof Flow && updatedObj instanceof Flow) {
+            val originalFlow = (originalObj as Flow)
+            val updatedFlow = (updatedObj as Flow)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new UpdateFlowInputBuilder();
+            builder.setNode(new NodeRef(nodeInstanceId));
+            val ufb = new UpdatedFlowBuilder(updatedFlow);
+            builder.setUpdatedFlow((ufb.build()));
+            val ofb = new OriginalFlowBuilder(originalFlow);
+            builder.setOriginalFlow(ofb.build());      
+            _salFlowService.updateFlow(builder.build());
+           
+        }
+    }
+    
+    override add(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Flow) {
+            val flow = (obj as Flow)
+            val tableInstanceId = instanceId.firstIdentifierOf(Table);
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new AddFlowInputBuilder(flow);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setFlowTable(new FlowTableRef(tableInstanceId));
+            _salFlowService.addFlow(builder.build());            
+        }
+    }
+    
+    override validate() throws IllegalStateException {
+        FlowTransactionValidator.validate(this)
+    }  
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransactionValidator.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransactionValidator.java
new file mode 100644 (file)
index 0000000..f6ffdb8
--- /dev/null
@@ -0,0 +1,9 @@
+package org.opendaylight.controller.frm.flow;
+
+public class FlowTransactionValidator {
+
+    public static void validate(FlowTransaction transaction) throws IllegalStateException {
+        // NOOP
+    }
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupCommitHandler.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupCommitHandler.xtend
new file mode 100644 (file)
index 0000000..2c5f42b
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.frm.group
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
+class GroupCommitHandler implements DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> {
+       
+    @Property
+    val SalGroupService groupService;
+    
+    new(SalGroupService groupService) {
+        _groupService = groupService;
+    }
+    
+    override requestCommit(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        return new GroupTransaction(modification,groupService);
+    }
+    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.xtend
new file mode 100644 (file)
index 0000000..a75a668
--- /dev/null
@@ -0,0 +1,48 @@
+package org.opendaylight.controller.frm.group
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group
+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.yangtools.concepts.Registration
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.slf4j.LoggerFactory
+
+class GroupProvider implements AutoCloseable {
+    
+    @Property
+    DataProviderService dataService;
+    
+    @Property
+    SalGroupService salGroupService;
+    
+    GroupCommitHandler commitHandler
+
+    Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>,DataObject>> commitHandlerRegistration;
+    
+    static val LOG = LoggerFactory.getLogger(GroupProvider);
+    
+    def void start() {
+        commitHandler = new GroupCommitHandler(salGroupService)
+        val InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder(Nodes)
+            .child(Node)
+            .augmentation(FlowCapableNode)
+            .child(Group)
+            .toInstance();
+        commitHandlerRegistration = dataService.registerCommitHandler(path,commitHandler);
+        LOG.info("Group Config Provider started.");
+    }
+
+    protected def startChange() {
+        return dataService.beginTransaction;
+    }
+    
+    override close() throws Exception {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransaction.xtend
new file mode 100644 (file)
index 0000000..54382ea
--- /dev/null
@@ -0,0 +1,75 @@
+package org.opendaylight.controller.frm.group
+
+import org.opendaylight.controller.frm.AbstractTransaction
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroupBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder
+
+class GroupTransaction extends AbstractTransaction {
+    
+    @Property
+    val SalGroupService groupService;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalGroupService groupService) {
+        super(modification)
+        _groupService = groupService;
+    }
+    
+    override remove(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Group) {
+            val group = (obj as Group)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new RemoveGroupInputBuilder(group);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            _groupService.removeGroup(builder.build());            
+        }
+    }
+    
+    override update(InstanceIdentifier<?> instanceId, DataObject originalObj, DataObject updatedObj) {
+        if(originalObj instanceof Group && updatedObj instanceof Group) {
+            val originalGroup = (originalObj as Group)
+            val updatedGroup = (updatedObj as Group)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new UpdateGroupInputBuilder();
+            builder.setNode(new NodeRef(nodeInstanceId));
+            val ufb = new UpdatedGroupBuilder(updatedGroup);
+            builder.setUpdatedGroup((ufb.build()));
+            val ofb = new OriginalGroupBuilder(originalGroup);
+            builder.setOriginalGroup(ofb.build());      
+            _groupService.updateGroup(builder.build());
+           
+        }
+    }
+    
+    override add(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Group) {
+            val group = (obj as Group)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new AddGroupInputBuilder(group);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            _groupService.addGroup(builder.build());            
+        }
+    }
+    
+    override validate() throws IllegalStateException {
+        GroupTransactionValidator.validate(this)
+    }  
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransactionValidator.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransactionValidator.java
new file mode 100644 (file)
index 0000000..a264c33
--- /dev/null
@@ -0,0 +1,9 @@
+package org.opendaylight.controller.frm.group;
+
+public class GroupTransactionValidator {
+
+    public static void validate(GroupTransaction transaction) throws IllegalStateException {
+        // NOOP
+    }
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterCommitHandler.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterCommitHandler.xtend
new file mode 100644 (file)
index 0000000..dd8d4c7
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.frm.meter
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
+class FlowCommitHandler implements DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> {
+       
+    @Property
+    val SalMeterService salMeterService;
+    
+    new(SalMeterService manager) {
+        _salMeterService = manager;
+    }
+    
+    override requestCommit(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        return new MeterTransaction(modification,salMeterService);
+    }
+    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.xtend
new file mode 100644 (file)
index 0000000..75d29d5
--- /dev/null
@@ -0,0 +1,48 @@
+package org.opendaylight.controller.frm.meter
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter
+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.meter.service.rev130918.SalMeterService
+import org.opendaylight.yangtools.concepts.Registration
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.slf4j.LoggerFactory
+
+class MeterProvider implements AutoCloseable {
+    
+    @Property
+    DataProviderService dataService;
+    
+    @Property
+    SalMeterService salMeterService;
+    
+    FlowCommitHandler commitHandler
+
+    Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>,DataObject>> commitHandlerRegistration;
+    
+    static val LOG = LoggerFactory.getLogger(MeterProvider);
+    
+    def void start() {
+        commitHandler = new FlowCommitHandler(salMeterService)
+        val InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder(Nodes)
+            .child(Node)
+            .augmentation(FlowCapableNode)
+            .child(Meter)
+            .toInstance();
+        commitHandlerRegistration = dataService.registerCommitHandler(path,commitHandler);
+        LOG.info("Meter Config Provider started.");
+    }
+
+    protected def startChange() {
+        return dataService.beginTransaction;
+    }
+    
+    override close() throws Exception {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransaction.xtend
new file mode 100644 (file)
index 0000000..3ed1f40
--- /dev/null
@@ -0,0 +1,66 @@
+package org.opendaylight.controller.frm.meter
+
+import org.opendaylight.controller.frm.AbstractTransaction
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
+class MeterTransaction extends AbstractTransaction {
+    
+    @Property
+    val SalMeterService salMeterService;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalMeterService salMeterService) {
+        super(modification)
+        _salMeterService = salMeterService;
+    }
+    
+    override remove(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Meter) {
+            val meter = (obj as Meter)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new RemoveMeterInputBuilder(meter);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            _salMeterService.removeMeter(builder.build());            
+        }
+    }
+    
+    override update(InstanceIdentifier<?> instanceId, DataObject originalObj, DataObject updatedObj) {
+        if(originalObj instanceof Meter && updatedObj instanceof Meter) {
+            val originalMeter = (originalObj as Meter)
+            val updatedMeter = (updatedObj as Meter)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new UpdateMeterInputBuilder();
+            builder.setNode(new NodeRef(nodeInstanceId));
+            val ufb = new UpdatedMeterBuilder(updatedMeter);
+            builder.setUpdatedMeter((ufb.build()));
+            val ofb = new OriginalMeterBuilder(originalMeter);
+            builder.setOriginalMeter(ofb.build());      
+            _salMeterService.updateMeter(builder.build());
+           
+        }
+    }
+    
+    override add(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Meter) {
+            val meter = (obj as Meter)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new AddMeterInputBuilder(meter);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            _salMeterService.addMeter(builder.build());            
+        }
+    }
+    
+    override validate() throws IllegalStateException {
+        MeterTransactionValidator.validate(this)
+    }  
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransactionValidator.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransactionValidator.java
new file mode 100644 (file)
index 0000000..d8afd2a
--- /dev/null
@@ -0,0 +1,9 @@
+package org.opendaylight.controller.frm.meter;
+
+public class MeterTransactionValidator {
+
+    public static void validate(MeterTransaction transaction) throws IllegalStateException {
+        // NOOP
+    }
+
+}
diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/yang/action-types.yang b/opendaylight/md-sal/model/model-flow-base/src/main/yang/action-types.yang
deleted file mode 100644 (file)
index 3850dd5..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-module opendaylight-action-types {
-    namespace "urn:opendaylight:action:types";
-    prefix action;
-
-    import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
-    import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
-    import opendaylight-l2-types {prefix l2t; revision-date "2013-08-27";}
-    import opendaylight-match-types {prefix match; revision-date "2013-10-26";}
-    
-    revision "2013-11-12" {
-        description "Initial revision of action service";
-    }
-    
-    typedef vlan-cfi {
-        type int32;    
-    }
-
-    grouping address {
-        choice address {
-            case ipv4 {
-                leaf ipv4-address {
-                    type inet:ipv4-prefix;
-                }
-            }
-            case ipv6 {
-                leaf ipv6-address {
-                    type inet:ipv6-prefix;
-                }
-            }
-        }
-    }  
-    
-    grouping action-list {
-        list action {
-            key "order";
-            leaf order {
-                type int32;
-            }
-            uses action;
-        }
-    }
-    
-    grouping action {
-        choice action {
-            case output-action {
-                leaf output-node-connector {
-                    type inet:uri;
-                }
-                
-                leaf max-length {
-                    type uint16 {
-                        range "0..65294";
-                    }
-                }                
-            }
-
-            case controller-action {
-                leaf max-length {
-                    type uint16 {
-                        range "0..65294";
-                    }
-                }
-            }
-            
-            case set-field {
-                container match {
-                    uses match:match;
-                }
-            }
-            
-            case set-queue-action {
-                leaf queue {
-                    type string; 
-                }
-                
-                leaf queue-id {
-                    type uint32; 
-                }
-            }
-
-            case pop-mpls-action {
-                leaf ethernet-type {
-                    type uint16; // TODO: define ethertype type
-                }
-            }
-
-            case set-mpls-ttl-action {
-                leaf mpls-ttl {
-                    type uint8;
-                }
-            }
-
-            case set-nw-ttl-action {
-                leaf nw-ttl {
-                    type uint8;
-                }
-            }
-
-            case push-pbb-action {
-                leaf ethernet-type {
-                    type uint16; // TODO: define ethertype type
-                }
-            }
-
-            case pop-pbb-action {
-                
-            }
-            
-            case push-mpls-action {
-                leaf ethernet-type {
-                    type uint16; // TODO: define ethertype type
-                }
-            }
-            
-            case dec-mpls-ttl {
-            }
-            
-            case dec-nw-ttl {
-            }
-            
-            case drop-action {
-            }
-            
-            case flood-action {
-            }
-            
-            case flood-all-action {
-            }
-            
-            case hw-path-action {
-            }
-            
-            case loopback-action {
-            }
-            
-            case pop-vlan-action {
-            }
-            
-            case push-vlan-action {
-                leaf ethernet-type {
-                    type uint16; // TODO: define ethertype type
-                }
-                leaf tag {               // TPID - 16 bits
-                    type int32;
-                } 
-                leaf pcp {               // PCP - 3 bits
-                    type int32;
-                }
-                leaf cfi {               // CFI - 1 bit (drop eligible)
-                    type vlan-cfi;
-                }
-                leaf vlan-id {           // VID - 12 bits
-                    type l2t:vlan-id;
-                }
-//                leaf tci {               //TCI = [PCP + CFI + VID]
-//                }
-//                leaf header {            //header = [TPID + TCI] 
-//                }
-            }
-            
-            case copy-ttl-out {
-            }
-            
-            case copy-ttl-in {
-            }
-            
-            case set-dl-dst-action {
-                leaf address {
-                    type yang:mac-address;
-                }
-            }
-            
-            case set-dl-src-action {
-                leaf address {
-                    type yang:mac-address;
-                }
-            }
-            case group-action {
-                leaf group {
-                    type string;
-                }
-                
-                leaf group-id {
-                    type uint32;
-                }
-            }
-            
-            case set-dl-type-action {
-                leaf dl-type {
-                    type l2t:ether-type;
-                }
-            }
-            
-            case set-next-hop-action {
-                uses address;
-            }
-            
-            case set-nw-dst-action {
-                uses address;            
-            }
-            
-            case set-nw-src-action{
-                uses address;            
-            }
-            
-            case set-nw-tos-action {
-                leaf tos {
-                    type int32;
-                }
-            }
-            
-            case set-tp-dst-action {
-                leaf port {
-                    type inet:port-number;
-                }                
-            }
-            case set-tp-src-action {
-                leaf port {
-                    type inet:port-number;
-                }                
-            }
-            case set-vlan-cfi-action {
-                leaf vlan-cfi {
-                    type vlan-cfi;
-                }
-            }
-            
-            case set-vlan-id-action {
-                leaf vlan-id {
-                    type l2t:vlan-id;
-                } 
-            }
-            
-            case set-vlan-pcp-action {
-                leaf vlan-pcp {
-                    type l2t:vlan-pcp;
-                }            
-            }
-            
-            case sw-path-action {            
-            }  
-        }
-    }
-}
\ No newline at end of file
index f03e28b..8c874e2 100644 (file)
@@ -236,4 +236,12 @@ module opendaylight-group-types {
        uses group-features;
     }
     
+    grouping groups {
+        list group {
+            key "group-id";                  
+        
+            uses group;
+        }
+    }
+    
 }
\ No newline at end of file
index 5ba92ab..7dcd254 100644 (file)
@@ -91,6 +91,11 @@ module opendaylight-match-types {
             description "IP ECN (2 bits in ToS field).";
             type uint8; 
         }
+        
+        leaf ip-proto {                
+           description "IP Proto (IPv4 or IPv6 Protocol Number).";             
+              type inet:ip-version;            
+               }
     } 
     
     grouping "ipv4-match-fields" {
diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-action-types.yang b/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-action-types.yang
new file mode 100644 (file)
index 0000000..81303d6
--- /dev/null
@@ -0,0 +1,343 @@
+module opendaylight-action-types {
+    namespace "urn:opendaylight:action:types";
+    prefix action;
+
+    import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
+    import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
+    import opendaylight-l2-types {prefix l2t; revision-date "2013-08-27";}
+    import opendaylight-match-types {prefix match; revision-date "2013-10-26";}
+    
+    revision "2013-11-12" {
+        description "Initial revision of action service";
+    }
+    
+    typedef vlan-cfi {
+        type int32;    
+    }
+
+    grouping address {
+        choice address {
+            case ipv4 {
+                leaf ipv4-address {
+                    type inet:ipv4-prefix;
+                }
+            }
+            case ipv6 {
+                leaf ipv6-address {
+                    type inet:ipv6-prefix;
+                }
+            }
+        }
+    }  
+    
+    grouping action-list {
+        list action {
+            key "order";
+            leaf order {
+                type int32;
+            }
+            uses action;
+        }
+    }
+    
+    grouping action {
+        choice action {
+            case output-action-case {
+                container output-action {
+                    leaf output-node-connector {
+                        type inet:uri;
+                    }
+                    
+                    leaf max-length {
+                        type uint16 {
+                            range "0..65294";
+                        }
+                    }
+                }
+            }
+
+            case controller-action-case {
+                container controller-action {
+                 leaf max-length {
+                     type uint16 {
+                         range "0..65294";
+                     }
+                 }
+             }
+            }
+             
+
+
+            case set-field-case {
+                container set-field {
+                     uses match:match;
+                 }
+             }
+             
+
+            case set-queue-action-case {
+                container set-queue-action {
+                 leaf queue {
+                     type string; 
+                 }
+                 leaf queue-id {
+                     type uint32; 
+                 }
+             }
+            }
+
+           case pop-mpls-action-case {
+                container pop-mpls-action {
+                 leaf ethernet-type {
+                     type uint16; // TODO: define ethertype type
+                 }
+             }
+            }
+
+            case set-mpls-ttl-action-case {
+                container set-mpls-ttl-action {
+                 leaf mpls-ttl {
+                     type uint8;
+                 }
+             }
+            }
+
+            case set-nw-ttl-action-case {
+                container set-nw-ttl-action {
+                 leaf nw-ttl {
+                     type uint8;
+                 }
+             }
+            }
+
+            case push-pbb-action-case {
+                container push-pbb-action {
+                 leaf ethernet-type {
+                     type uint16; // TODO: define ethertype type
+                 }
+             }
+            }
+
+            case pop-pbb-action-case {
+                container pop-pbb-action {
+                 
+             }
+            }
+             
+
+            case push-mpls-action-case {
+                container push-mpls-action {
+                 leaf ethernet-type {
+                     type uint16; // TODO: define ethertype type
+                 }
+             }
+            }
+             
+
+            case dec-mpls-ttl-case {
+                container dec-mpls-ttl {
+                }
+             }
+             
+
+            case dec-nw-ttl-case {
+                container dec-nw-ttl {
+                }
+             }
+             
+
+            case drop-action-case {
+                container drop-action {
+                }
+             }
+             
+
+            case flood-action-case {
+                container flood-action {
+                }
+             }
+             
+
+            case flood-all-action-case {
+                container flood-all-action {
+                }
+             }
+             
+
+            case hw-path-action-case {
+                container hw-path-action {
+                }
+             }
+             
+
+            case loopback-action-case {
+                container loopback-action {
+                }
+             }
+             
+
+            case pop-vlan-action-case {
+                container pop-vlan-action {
+                }
+             }
+             
+            
+            
+            case push-vlan-action-case {
+                container push-vlan-action {
+                 leaf ethernet-type {
+                     type uint16; // TODO: define ethertype type
+                 }
+                leaf tag {               // TPID - 16 bits
+                    type int32;
+                } 
+                leaf pcp {               // PCP - 3 bits
+                    type int32;
+                }
+                leaf cfi {               // CFI - 1 bit (drop eligible)
+                    type vlan-cfi;
+                }
+                leaf vlan-id {           // VID - 12 bits
+                    type l2t:vlan-id;
+                }
+//                leaf tci {               //TCI = [PCP + CFI + VID]
+//                }
+//                leaf header {            //header = [TPID + TCI] 
+//                }
+                }
+             }
+            
+            case copy-ttl-out-case {
+                container copy-ttl-out {
+                }
+             }
+             
+
+            case copy-ttl-in-case {
+                container copy-ttl-in {
+                }
+             }
+             
+
+            case set-dl-dst-action-case {
+                container set-dl-dst-action {
+                 leaf address {
+                     type yang:mac-address;
+                 }
+             }
+            }
+             
+
+            case set-dl-src-action-case {
+                container set-dl-src-action {
+                 leaf address {
+                     type yang:mac-address;
+                 }
+             }
+
+            }
+            case group-action-case {
+                container group-action {
+                 leaf group {
+                     type string;
+                 }
+                
+                leaf group-id {
+                    type uint32;
+                }
+             }
+            }
+            
+            case set-dl-type-action-case {
+                container set-dl-type-action {
+                 leaf dl-type {
+                     type l2t:ether-type;
+                 }
+             }
+            }
+             
+
+            case set-next-hop-action-case {
+                container set-next-hop-action {
+                 uses address;
+             }
+            }
+             
+
+            case set-nw-dst-action-case {
+                container set-nw-dst-action {
+                 uses address;            
+             }
+            }
+             
+
+            case set-nw-src-action-case {
+                container set-nw-src-action {
+                 uses address;            
+             }
+            }
+             
+
+            case set-nw-tos-action-case {
+                container set-nw-tos-action {
+                 leaf tos {
+                     type int32;
+                 }
+             }
+            }
+             
+
+            case set-tp-dst-action-case {
+                container set-tp-dst-action {
+                 leaf port {
+                     type inet:port-number;
+                 }                
+             }
+
+            }
+            case set-tp-src-action-case {
+                container set-tp-src-action {
+                 leaf port {
+                     type inet:port-number;
+                 }                
+             }
+
+            }
+            case set-vlan-cfi-action-case {
+                container set-vlan-cfi-action {
+                 leaf vlan-cfi {
+                     type vlan-cfi;
+                 }
+             }
+            }
+             
+
+            case set-vlan-id-action-case {
+                container set-vlan-id-action {
+                 leaf vlan-id {
+                     type l2t:vlan-id;
+                 } 
+             }
+            }
+             
+
+            case set-vlan-pcp-action-case {
+                container set-vlan-pcp-action {
+                 leaf vlan-pcp {
+                     type l2t:vlan-pcp;
+                 }            
+             }
+            }
+             
+
+            case sw-path-action-case {            
+                container sw-path-action {
+                }  
+             }  
+         }
+     }
+}
\ No newline at end of file
@@ -6,6 +6,7 @@ module opendaylight-flow-types {
     import ietf-yang-types {prefix yang; revision-date "2010-09-24";}    
     import opendaylight-match-types {prefix match; revision-date "2013-10-26";}
     import opendaylight-action-types {prefix action;}
+    import opendaylight-meter-types {prefix meter; revision-date "2013-09-18";}
 
     revision "2013-10-26" {
         description "Initial revision of flow service";
@@ -21,46 +22,54 @@ module opendaylight-flow-types {
         }
     }
 
-    grouping instruction {
-        choice instruction {
-            case go-to-table {
-                leaf table_id {
-                    type uint8;
-                }
+     grouping instruction {
+         choice instruction {
+            case go-to-table-case {
+                container go-to-table {
+                 leaf table_id {
+                     type uint8;
+                 }
+             }
             }
-            
-            case write-metadata {
-                leaf metadata {
-                    type uint64;
-                }
-                
-                leaf metadata-mask {
-                    type uint64;
-                }
+             
+            case write-metadata-case {
+                container write-metadata {
+                 leaf metadata {
+                     type uint64;
+                 }
+                 
+                 leaf metadata-mask {
+                     type uint64;
+                 }
+             }
             }
-            
-            case write-actions {
-                uses action:action-list;
+             
+            case write-actions-case {
+                container write-actions {
+                 uses action:action-list;
+             }
             }
-            
-            case apply-actions {
-                uses action:action-list;
+             
+            case apply-actions-case {
+                container apply-actions {
+                 uses action:action-list;
+             }
             }
-            
-            case clear-actions {
-                uses action:action-list;
+             
+            case clear-actions-case {
+                container clear-actions {
+                 uses action:action-list;
+             }
             }
-            
-            case meter {
-                leaf meter {
-                    type string;
-                }
-                
-                leaf meter-id {
-                    type uint32;
-                }
-            }   
-        }
+             
+            case meter-case {
+                container meter {
+                     leaf meter-id {
+                        type meter:meter-id;
+                     } 
+                 }
+             }
+         }
     }
     
     typedef flow-mod-flags {
@@ -161,7 +170,7 @@ module opendaylight-flow-types {
     grouping flow-statistics {
         leaf packet-count {
             type yang:counter64;
-        } 
+        }
 
         leaf byte-count {
             type yang:counter64;
index 005f7c3..d717e87 100644 (file)
@@ -7,6 +7,10 @@ module flow-node-inventory {
     import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
     import opendaylight-port-types {prefix port;revision-date "2013-09-25";}
     import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
+    import opendaylight-table-types {prefix table;revision-date "2013-10-26";}
+    import opendaylight-flow-types {prefix flow;revision-date "2013-10-26";}
+    import opendaylight-group-types {prefix group;revision-date "2013-10-18";}
+    import opendaylight-meter-types {prefix meter;revision-date "2013-09-18";}
     
     revision "2013-08-19" {
         description "Flow Capable Node extensions to the Inventory model";
@@ -34,9 +38,37 @@ module flow-node-inventory {
         }
     }
 
-    grouping table {
-
+    typedef flow-id {
+        type uint32; // Note: This doesn't really belong here, and not sure if unint32 is right
+    }
 
+    grouping tables {
+        list table {
+            key "id"; 
+    
+            leaf id {
+                    type uint8;
+            }            
+    
+            uses table:table-features;
+    
+            list flow {
+                key "id"; 
+    
+                leaf id {
+                    type flow-id;
+                }           
+    
+                uses flow:flow;
+            }
+        }
+    }
+    
+    grouping meters {
+        list meter {
+            key "meter-id";
+            uses meter:meter;
+        }
     }
 
     grouping flow-node {
@@ -57,16 +89,10 @@ module flow-node-inventory {
             type string;
         }
 
-        container tables {
-            uses feature;
-            list table {
-                uses table;
-            }
-        }
-        
-        container group-tables {
-            uses feature;
-        }
+        uses tables;
+        uses group:groups;
+        uses meters;
+        // TODO: ports
         
         container supported-match-types {
             list match-type {
diff --git a/opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang b/opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang
new file mode 100644 (file)
index 0000000..aaaedc1
--- /dev/null
@@ -0,0 +1,23 @@
+module opendaylight-inventory-config {
+    namespace "urn:opendaylight:inventory:config";
+    prefix inv-config;
+
+    import yang-ext {prefix ext; revision-date "2013-07-09";}
+    import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
+    import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
+    import opendaylight-inventory {prefix inv; revision-date "2013-08-19";}
+
+
+    revision "2013-08-19" {
+        description "Initial revision of Inventory model";
+    }
+    /** Base structure **/
+    container nodes {
+        list node {
+            key "id";
+            ext:context-instance "node-context";
+
+            uses inv:node;
+        }
+    }    
+}
\ No newline at end of file
index 0e78598..b34621d 100644 (file)
@@ -12,7 +12,7 @@
     </scm>
 
     <modules>
-        <!--  Common APIs & Implementation -->
+        <!-- Common APIs & Implementation -->
         <module>sal-common</module>
         <module>sal-common-api</module>
         <module>sal-common-impl</module>
         <module>sal-connector-api</module>
         <module>sal-rest-connector</module>
         <module>sal-netconf-connector</module>
-        
+
+        <module>zeromq-routingtable/implementation</module>
+        <module>sal-remoterpc-connector/implementation</module>
         <!-- Clustered Data Store -->
         <module>clustered-data-store/implementation</module>
 
         <module>inventory-manager</module>
         <module>statistics-manager</module>
         <module>forwardingrules-manager</module>
-        
+
         <!-- Compability Packages -->
         <module>compatibility</module>
-        <module>zeromq-routingtable/implementation</module>
-        <module>sal-zeromq-connector</module>
     </modules>
 
 
     <profiles>
         <profile>
-           <id>integrationtests</id>
-           <activation>
-               <activeByDefault>false</activeByDefault>
-           </activation>
+            <id>integrationtests</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
             <modules>
                 <module>sal-binding-it</module>
-                <module>zeromq-routingtable/integrationtest</module>
                 <module>clustered-data-store/integrationtest</module>
-                <module>test</module>
+                <!--module>zeromq-routingtable/integrationtest</module -->
+                <!--module>sal-remoterpc-connector/integrationtest</module -->
+                <!--module>test/sal-rest-connector-it</modulei -->
             </modules>
         </profile>
         <profile>
-          <id>IDE</id>
-          <activation>
-            <property>
-              <name>m2e.version</name>
-            </property>
-          </activation>
-          <build>
-            <!-- Put the IDE's build output in a folder other than target, so that IDE builds don't interact with Maven builds -->
-            <directory>target-ide</directory>
-          </build>
+            <id>IDE</id>
+            <activation>
+                <property>
+                    <name>m2e.version</name>
+                </property>
+            </activation>
+            <build>
+                <!-- Put the IDE's build output in a folder other than target, 
+                    so that IDE builds don't interact with Maven builds -->
+                <directory>target-ide</directory>
+            </build>
         </profile>
     </profiles>
 
         <guava.version>14.0.1</guava.version>
         <osgi.core.version>5.0.0</osgi.core.version>
         <junit.version>4.8.1</junit.version>
+        <powermock.version>1.5.1</powermock.version>
+        <mockito.version>1.9.5</mockito.version>
         <xtend.version>2.4.3</xtend.version>
         <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
         <jacoco.version>0.5.3.201107060350</jacoco.version>
+        <sal.version>0.5.1-SNAPSHOT</sal.version>  <!-- AD Sal version -->
+
         <!-- Sonar properties using jacoco to retrieve integration test results -->
         <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
         <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
     <pluginRepositories>
         <!-- OpenDayLight Repo Mirror -->
         <pluginRepository>
-          <id>opendaylight-mirror</id>
-          <name>opendaylight-mirror</name>
-          <url>${nexusproxy}/groups/public/</url>
-          <snapshots>
-              <enabled>false</enabled>
-          </snapshots>
-          <releases>
-              <enabled>true</enabled>
-              <updatePolicy>never</updatePolicy>
-          </releases>
+            <id>opendaylight-mirror</id>
+            <name>opendaylight-mirror</name>
+            <url>${nexusproxy}/groups/public/</url>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </releases>
         </pluginRepository>
         <!-- OpenDayLight Snapshot artifact -->
         <pluginRepository>
-          <id>opendaylight-snapshot</id>
-          <name>opendaylight-snapshot</name>
-          <url> ${nexusproxy}/repositories/opendaylight.snapshot/</url>
-          <snapshots>
-              <enabled>true</enabled>
-          </snapshots>
-          <releases>
-              <enabled>false</enabled>
-          </releases>
+            <id>opendaylight-snapshot</id>
+            <name>opendaylight-snapshot</name>
+            <url> ${nexusproxy}/repositories/opendaylight.snapshot/</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
         </pluginRepository>
     </pluginRepositories>
 
     <repositories>
         <!-- OpenDayLight Repo Mirror -->
         <repository>
-          <id>opendaylight-mirror</id>
-          <name>opendaylight-mirror</name>
-          <url>${nexusproxy}/groups/public/</url>
-          <snapshots>
-              <enabled>false</enabled>
-          </snapshots>
-          <releases>
-              <enabled>true</enabled>
-              <updatePolicy>never</updatePolicy>
-          </releases>
+            <id>opendaylight-mirror</id>
+            <name>opendaylight-mirror</name>
+            <url>${nexusproxy}/groups/public/</url>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </releases>
         </repository>
         <!-- OpenDayLight Snapshot artifact -->
         <repository>
-          <id>opendaylight-snapshot</id>
-          <name>opendaylight-snapshot</name>
-          <url> ${nexusproxy}/repositories/opendaylight.snapshot/</url>
-          <snapshots>
-              <enabled>true</enabled>
-          </snapshots>
-          <releases>
-              <enabled>false</enabled>
-          </releases>
+            <id>opendaylight-snapshot</id>
+            <name>opendaylight-snapshot</name>
+            <url> ${nexusproxy}/repositories/opendaylight.snapshot/</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
         </repository>
     </repositories>
 
                 <artifactId>yang-data-api</artifactId>
                 <version>${yang.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-data-impl</artifactId>
+                <version>${yang.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yang-model-api</artifactId>
                 <artifactId>sal-connector-api</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal</artifactId>
+                <version>${sal.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.osgi</groupId>
+                        <artifactId>org.osgi.compendium</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
 
             <!-- Supporting Libraries -->
             <dependency>
                 <artifactId>org.eclipse.xtend.lib</artifactId>
                 <version>${xtend.version}</version>
             </dependency>
-
+            <dependency>
+                <groupId>org.osgi</groupId>
+                <artifactId>org.osgi.core</artifactId>
+                <version>${osgi.core.version}</version>
+            </dependency>
             <!-- Testing Dependencies -->
             <dependency>
                 <groupId>junit</groupId>
             <dependency>
                 <groupId>org.mockito</groupId>
                 <artifactId>mockito-all</artifactId>
-                <version>1.9.5</version>
+                <version>${mockito.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.powermock</groupId>
+                <artifactId>powermock-module-junit4</artifactId>
+                <version>${powermock.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.powermock</groupId>
+                <artifactId>powermock-api-mockito</artifactId>
+                <version>${powermock.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.powermock</groupId>
+                <artifactId>powermock-core</artifactId>
+                <version>${powermock.version}</version>
                 <scope>test</scope>
             </dependency>
         </dependencies>
                     <artifactId>maven-bundle-plugin</artifactId>
                     <version>${bundle.plugin.version}</version>
                     <extensions>true</extensions>
-                    <!--executions>
-                        <execution>
-                            <id>bundle-manifest</id>
-                            <phase>process-classes</phase>
-                            <goals>
-                                <goal>manifest</goal>
-                            </goals>
-                        </execution>
-                    </executions-->
+                    <!--executions> <execution> <id>bundle-manifest</id> 
+                        <phase>process-classes</phase> <goals> <goal>manifest</goal> </goals> </execution> 
+                        </executions -->
                     <configuration>
                         <instructions>
                             <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
                     <artifactId>jacoco-maven-plugin</artifactId>
                     <version>${jacoco.version}</version>
                 </plugin>
-                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+                <!--This plugin's configuration is used to store Eclipse 
+                    m2e settings only. It has no influence on the Maven build itself. -->
                 <plugin>
                     <groupId>org.eclipse.m2e</groupId>
                     <artifactId>lifecycle-mapping</artifactId>
                                         </goals>
                                     </pluginExecutionFilter>
                                     <action>
-                                        <ignore/>
+                                        <ignore />
                                     </action>
                                 </pluginExecution>
                                 <pluginExecution>
                                         </goals>
                                     </pluginExecutionFilter>
                                     <action>
-                                      <ignore/>
+                                        <ignore />
                                     </action>
                                 </pluginExecution>
                                 <pluginExecution>
                                         </goals>
                                     </pluginExecutionFilter>
                                     <action>
-                                        <ignore/>
+                                        <ignore />
                                     </action>
                                 </pluginExecution>
                             </pluginExecutions>
index ac84aab..f9f7209 100644 (file)
             <version>${slf4j.version}</version>
             <scope>test</scope>
         </dependency>
+            <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>ietf-inet-types</artifactId>
+            <version>2010.09.24.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+               <groupId>org.opendaylight.controller.model</groupId>
+               <artifactId>model-flow-base</artifactId>
+               <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+               <groupId>org.opendaylight.controller.model</groupId>
+               <artifactId>model-flow-service</artifactId>
+               <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+               <groupId>org.opendaylight.controller.model</groupId>
+               <artifactId>model-flow-statistics</artifactId>
+               <version>1.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 </project>
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java
new file mode 100644 (file)
index 0000000..bff77be
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.sal.binding.test;
+
+import junit.framework.Assert;
+
+
+import org.opendaylight.yangtools.yang.binding.Augmentable;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+public class AugmentationVerifier<T extends Augmentable<T>> {
+
+    private T object;
+
+    public AugmentationVerifier(T objectToVerify) {
+        this.object = objectToVerify;
+    }
+
+    public AugmentationVerifier<T> assertHasAugmentation(Class<? extends Augmentation<T>> augmentation) {
+        assertHasAugmentation(object, augmentation);
+        return (AugmentationVerifier<T>) this;
+    }
+
+    public static <T extends Augmentable<T>> void assertHasAugmentation(T object,
+            Class<? extends Augmentation<T>> augmentation) {
+        Assert.assertNotNull(object);
+        Assert.assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation));
+    }
+
+    public static <T extends Augmentable<T>> AugmentationVerifier<T> from(T obj) {
+        return new AugmentationVerifier<T>(obj);
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/BindingTestUtilities.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/BindingTestUtilities.java
new file mode 100644 (file)
index 0000000..7d14919
--- /dev/null
@@ -0,0 +1,5 @@
+package org.opendaylight.controller.sal.binding.test;
+
+public class BindingTestUtilities {
+
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/MultipleAugmentationPuts.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/MultipleAugmentationPuts.java
new file mode 100644 (file)
index 0000000..6d1a699
--- /dev/null
@@ -0,0 +1,210 @@
+package org.opendaylight.controller.sal.binding.test.bugfix;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
+import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
+import org.opendaylight.controller.sal.binding.test.AugmentationVerifier;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter32;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter64;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
+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.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatisticsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterStatisticsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.Duration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.DurationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsKey;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+
+import com.google.common.collect.FluentIterable;
+
+import static org.junit.Assert.*;
+
+public class MultipleAugmentationPuts extends AbstractDataServiceTest implements DataChangeListener {
+
+    private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
+    private static final String NODE_ID = "openflow:1";
+
+    private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
+
+    private static final Map<QName, Object> NODE_KEY_BI = Collections.<QName, Object> singletonMap(NODE_ID_QNAME,
+            NODE_ID);
+
+    private static final InstanceIdentifier<Nodes> NODES_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
+            .toInstance();
+
+    private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier
+            .builder(NODES_INSTANCE_ID_BA) //
+            .child(Node.class, NODE_KEY).toInstance();
+
+    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
+    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+            .node(Nodes.QNAME) //
+            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
+            .toInstance();
+    private DataChangeEvent<InstanceIdentifier<?>, DataObject> receivedChangeEvent;
+
+    /**
+     * Test for Bug 148
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testAugmentSerialization() throws Exception {
+
+        baDataService.registerDataChangeListener(NODES_INSTANCE_ID_BA, this);
+
+        Node flowCapableNode = createTestNode(FlowCapableNode.class, flowCapableNodeAugmentation());
+        commitNodeAndVerifyTransaction(flowCapableNode);
+
+        assertNotNull(receivedChangeEvent);
+        verifyNode((Nodes) receivedChangeEvent.getUpdatedOperationalSubtree(), flowCapableNode);
+
+        Nodes nodes = checkForNodes();
+        verifyNode(nodes, flowCapableNode).assertHasAugmentation(FlowCapableNode.class);
+        ;
+        assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
+        Node meterStatsNode = createTestNode(NodeMeterStatistics.class, nodeMeterStatistics());
+        commitNodeAndVerifyTransaction(meterStatsNode);
+
+        assertNotNull(receivedChangeEvent);
+        verifyNode((Nodes) receivedChangeEvent.getUpdatedOperationalSubtree(), meterStatsNode);
+
+        assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
+
+        Node mergedNode = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
+
+        AugmentationVerifier.from(mergedNode) //
+                .assertHasAugmentation(FlowCapableNode.class) //
+                .assertHasAugmentation(NodeMeterStatistics.class);
+
+        assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
+
+        Node meterStatsNodeWithDuration = createTestNode(NodeMeterStatistics.class, nodeMeterStatistics(5, true));
+        commitNodeAndVerifyTransaction(meterStatsNodeWithDuration);
+
+        
+        Node nodeWithUpdatedList = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
+        AugmentationVerifier.from(nodeWithUpdatedList) //
+                .assertHasAugmentation(FlowCapableNode.class) //
+                .assertHasAugmentation(NodeMeterStatistics.class);
+        
+        List<MeterStats> meterStats = nodeWithUpdatedList.getAugmentation(NodeMeterStatistics.class).getMeterStatistics().getMeterStats();
+        assertNotNull(meterStats);
+        assertFalse(meterStats.isEmpty());
+        assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
+        testNodeRemove();
+    }
+
+    private <T extends Augmentation<Node>> Node createTestNode(Class<T> augmentationClass, T augmentation) {
+        NodeBuilder nodeBuilder = new NodeBuilder();
+        nodeBuilder.setId(new NodeId(NODE_ID));
+        nodeBuilder.setKey(NODE_KEY);
+        nodeBuilder.addAugmentation(augmentationClass, augmentation);
+        return nodeBuilder.build();
+    }
+
+    private DataModificationTransaction commitNodeAndVerifyTransaction(Node original) throws Exception {
+        DataModificationTransaction transaction = baDataService.beginTransaction();
+        transaction.putOperationalData(NODE_INSTANCE_ID_BA, original);
+        RpcResult<TransactionStatus> result = transaction.commit().get();
+        assertEquals(TransactionStatus.COMMITED, result.getResult());
+        return transaction;
+    }
+
+    private void testNodeRemove() throws Exception {
+        DataModificationTransaction transaction = baDataService.beginTransaction();
+        transaction.removeOperationalData(NODE_INSTANCE_ID_BA);
+        RpcResult<TransactionStatus> result = transaction.commit().get();
+        assertEquals(TransactionStatus.COMMITED, result.getResult());
+
+        Node node = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
+        assertNull(node);
+    }
+
+    private AugmentationVerifier<Node> verifyNode(Nodes nodes, Node original) {
+        assertNotNull(nodes);
+        assertNotNull(nodes.getNode());
+        assertEquals(1, nodes.getNode().size());
+        Node readedNode = nodes.getNode().get(0);
+        assertEquals(original.getId(), readedNode.getId());
+        assertEquals(original.getKey(), readedNode.getKey());
+        return new AugmentationVerifier<Node>(readedNode);
+    }
+
+    private void assertBindingIndependentVersion(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
+        CompositeNode node = biDataService.readOperationalData(nodeId);
+        assertNotNull(node);
+    }
+
+    private Nodes checkForNodes() {
+        return (Nodes) baDataService.readOperationalData(NODES_INSTANCE_ID_BA);
+    }
+
+    private NodeMeterStatistics nodeMeterStatistics() {
+        return nodeMeterStatistics(10, false);
+    }
+
+    private NodeMeterStatistics nodeMeterStatistics(int count, boolean setDuration) {
+        NodeMeterStatisticsBuilder nmsb = new NodeMeterStatisticsBuilder();
+        MeterStatisticsBuilder meterStats = new MeterStatisticsBuilder();
+
+        List<MeterStats> stats = new ArrayList<>(count);
+        for (int i = 0; i <= count; i++) {
+            MeterStatsBuilder statistic = new MeterStatsBuilder();
+            statistic.setKey(new MeterStatsKey(new MeterId((long) i)));
+            statistic.setByteInCount(new Counter64(BigInteger.valueOf(34590 + i)));
+            statistic.setFlowCount(new Counter32(4569L + i));
+
+            if (setDuration) {
+                DurationBuilder duration = new DurationBuilder();
+                duration.setNanosecond(new Counter32(70L));
+                statistic.setDuration(duration.build());
+            }
+
+            stats.add(statistic.build());
+        }
+        meterStats.setMeterStats(stats);
+        nmsb.setMeterStatistics(meterStats.build());
+        return nmsb.build();
+    }
+
+    private FlowCapableNode flowCapableNodeAugmentation() {
+        FlowCapableNodeBuilder fnub = new FlowCapableNodeBuilder();
+        fnub.setHardware("Hardware Foo");
+        fnub.setManufacturer("Manufacturer Foo");
+        fnub.setSerialNumber("Serial Foo");
+        fnub.setDescription("Description Foo");
+        fnub.setSoftware("JUnit emulated");
+        FlowCapableNode fnu = fnub.build();
+        return fnu;
+    }
+
+    @Override
+    public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
+        receivedChangeEvent = change;
+    }
+
+}
index 5a98767..56fbb9a 100644 (file)
@@ -11,13 +11,16 @@ import java.util.concurrent.Executors;
 
 
 
+
+
+
+
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
@@ -26,7 +29,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
@@ -177,13 +181,11 @@ public class DOMCodecBug01Test extends AbstractDataServiceTest {
         List<Action> actionList = new ArrayList<>();
         PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
         popMplsAction.setEthernetType(34);
-        actionList.add(new ActionBuilder().setAction(popMplsAction.build()).setOrder(10).build());
+        actionList.add(new ActionBuilder().setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsAction.build()).build()).setOrder(10).build());
 
         applyActions.setAction(actionList );
-        
-
 
-        instruction.setInstruction(applyActions.build());
+        instruction.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActions.build()).build());
 
 
         List<Instruction> instructionList = Collections.<Instruction>singletonList(instruction.build());
@@ -207,7 +209,6 @@ public class DOMCodecBug01Test extends AbstractDataServiceTest {
         match.setLayer4Match(new TcpMatchBuilder().build());
         flow.setMatch(match.build());
         
-        System.out.println("Putting the configuration Data................");
         path1 = InstanceIdentifier.builder(Flows.class).child(Flow.class, key).toInstance();
        // DataObject cls = (DataObject) modification.readConfigurationData(path1);
         modification.putConfigurationData(path1, flow.build());
index 7111501..ea36f81 100644 (file)
@@ -4,32 +4,12 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-
-
-
-
-
-
-
-
-
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Future;
 
-
-
-
-
-
-
-
-
-
-
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
@@ -37,16 +17,27 @@ import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.controller.sal.binding.impl.connect.dom.CommitHandlersTransactions;
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpVersion;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
@@ -56,7 +47,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 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.l2.types.rev130827.VlanId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -72,13 +66,16 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
     private static final QName FLOW_ID_QNAME = QName.create(Flow.QNAME, "id");
     private static final QName FLOW_NODE_QNAME = QName.create(Flow.QNAME, "node");
-    private static final long FLOW_ID = 1234;
-    private static final String NODE_ID = "node:1";
-    
-    private DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modificationCapture;
+    private static final QName TABLE_ID_QNAME = QName.create(Table.QNAME, "id");
 
+    private static final String NODE_ID = "node:1";
+    private static final FlowId FLOW_ID = new FlowId(1234L);
+    private static final Short TABLE_ID = Short.valueOf((short) 0);
 
     private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
+    private static final FlowKey FLOW_KEY = new FlowKey(FLOW_ID);
+
+    private DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modificationCapture;
 
     private static final Map<QName, Object> NODE_KEY_BI = Collections.<QName, Object> singletonMap(NODE_ID_QNAME,
             NODE_ID);
@@ -93,34 +90,41 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
             .toInstance();
     private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
 
-    private static final FlowKey FLOW_KEY = new FlowKey(FLOW_ID, NODE_REF);
-
     private static final Map<QName, Object> FLOW_KEY_BI = //
-    ImmutableMap.<QName, Object> of(FLOW_ID_QNAME, FLOW_ID, FLOW_NODE_QNAME, NODE_INSTANCE_ID_BI);
+    ImmutableMap.<QName, Object> of(FLOW_ID_QNAME, FLOW_ID.getValue());
+
+    private static final Map<QName, Object> TABLE_KEY_BI = //
+    ImmutableMap.<QName, Object> of(TABLE_ID_QNAME, TABLE_ID);;
 
     private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier FLOW_INSTANCE_ID_BI = //
     org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-            .node(Flows.QNAME) //
+            .node(Nodes.QNAME) //
+            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
+            .nodeWithKey(Table.QNAME, TABLE_KEY_BI) //
             .nodeWithKey(Flow.QNAME, FLOW_KEY_BI) //
             .toInstance();
-    
-    private static final InstanceIdentifier<Flows> FLOWS_PATH_BA = //
-            InstanceIdentifier.builder(Flows.class) //
-                    .toInstance();
-            
-    
+    private static final TableKey TABLE_KEY_BA = new TableKey((short) 0);
+
+    private static final InstanceIdentifier<Flow> FLOWS_PATH_BA = //
+    InstanceIdentifier.builder(NODE_INSTANCE_ID_BA) //
+            .augmentation(FlowCapableNode.class) //
+            .child(Table.class, TABLE_KEY_BA) //
+            .child(Flow.class) //
+            .toInstance();
+
     private static final InstanceIdentifier<Flow> FLOW_INSTANCE_ID_BA = //
-    InstanceIdentifier.builder(Flows.class) //
+    InstanceIdentifier.builder(FLOWS_PATH_BA.firstIdentifierOf(Table.class)) //
             .child(Flow.class, FLOW_KEY) //
             .toInstance();
-    
+
     @Test
     public void simpleModifyOperation() throws Exception {
+
         assertNull(biDataService.readConfigurationData(FLOW_INSTANCE_ID_BI));
-        
+
         registerCommitHandler();
-        
-        CompositeNode domflow = createXmlFlow();
+
+        CompositeNode domflow = createTestFlow();
         DataModificationTransaction biTransaction = biDataService.beginTransaction();
         biTransaction.putConfigurationData(FLOW_INSTANCE_ID_BI, domflow);
         RpcResult<TransactionStatus> biResult = biTransaction.commit().get();
@@ -130,62 +134,78 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
         assertNotNull(flow);
         assertNotNull(flow.getMatch());
         assertEquals(TransactionStatus.COMMITED, biResult.getResult());
-        
-    }
 
-    
+    }
 
     private void registerCommitHandler() {
         DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> flowTestCommitHandler = new DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>() {
-            
-            
+
             @Override
             public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<InstanceIdentifier<? extends DataObject>, DataObject> requestCommit(
                     DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
                 modificationCapture = modification;
                 return CommitHandlersTransactions.allwaysSuccessfulTransaction(modification);
             }
-            
-            
+
         };
-        Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>> registration = baDataService.registerCommitHandler(FLOWS_PATH_BA, flowTestCommitHandler);
+        Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>> registration = baDataService
+                .registerCommitHandler(FLOWS_PATH_BA, flowTestCommitHandler);
         assertNotNull(registration);
     }
-    
-    private CompositeNode createXmlFlow() {
-        
-        FlowBuilder flow = new FlowBuilder();
-        MatchBuilder match = new MatchBuilder();
-        VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
-        VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
-        VlanId vlanId = new VlanId(10);
-        vlanBuilder.setVlanId(vlanIdBuilder.setVlanId(vlanId).build());
-        match.setVlanMatch(vlanBuilder.build());
 
+    private CompositeNode createTestFlow() {
+        FlowBuilder flow = new FlowBuilder();
         flow.setKey(FLOW_KEY);
+        Short tableId = 0;
+        flow.setTableId(tableId);
+        MatchBuilder match = new MatchBuilder();
+        match.setIpMatch(new IpMatchBuilder().setIpProto(IpVersion.Ipv4).build());
+        Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
+        // ipv4Match.setIpv4Destination(new Ipv4Prefix(cliInput.get(4)));
+        Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
+        ipv4Match.setIpv4Destination(prefix);
+        Ipv4Match i4m = ipv4Match.build();
+        match.setLayer3Match(i4m);
         flow.setMatch(match.build());
-        flow.setNode(NODE_REF);
-        InstructionsBuilder instructions = new InstructionsBuilder();
-        InstructionBuilder instruction = new InstructionBuilder();
-        instruction.setOrder(10);
-        ApplyActionsBuilder applyActions = new ApplyActionsBuilder();
-        List<Action> actionList = new ArrayList<>();
-        PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
-        popMplsAction.setEthernetType(34);
-        actionList.add(new ActionBuilder().setAction(popMplsAction.build()).setOrder(0).build());
 
-        applyActions.setAction(actionList );
-        
 
 
-        instruction.setInstruction(applyActions.build());
+        // Create a drop action
+        /*
+         * Note: We are mishandling drop actions DropAction dropAction = new
+         * DropActionBuilder().build(); ActionBuilder ab = new ActionBuilder();
+         * ab.setAction(dropAction);
+         */
+
+        DecNwTtl decNwTtl = new DecNwTtlBuilder().build();
+        ActionBuilder ab = new ActionBuilder();
+        ActionKey actionKey = new ActionKey(0);
+        ab.setKey(actionKey );
+        ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
+
+        // Add our drop action to a list
+        List<Action> actionList = new ArrayList<Action>();
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        InstructionBuilder ib = new InstructionBuilder();
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
+        // Put our Instruction in a list of Instructions
+        InstructionsBuilder isb = new InstructionsBuilder();
+        List<Instruction> instructions = new ArrayList<Instruction>();
+        instructions.add(ib.build());
+        isb.setInstruction(instructions);
 
-        List<Instruction> instructionList = Collections.<Instruction>singletonList(instruction.build());
-        instructions.setInstruction(instructionList );
+        // Add our instructions to the flow
+        flow.setInstructions(isb.build());
 
-        flow.setInstructions(instructions.build());
-        
+        flow.setPriority(2);
+        flow.setFlowName("Foo Name");
         CompositeNode domFlow = mappingService.toDataDom(flow.build());
         return domFlow;
     }
index 338561a..9b81429 100644 (file)
@@ -59,14 +59,14 @@ public abstract class AbstractTest {
                 mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), //
                 systemProperty("osgi.bundles.defaultStartLevel").value("4"),
 
-                
-                
                 mdSalCoreBundles(),
 
                 bindingAwareSalBundles(),
                 configMinumumBundles(),
                 // BASE Models
-                baseModelBundles(), flowCapableModelBundles(), junitAndMockitoBundles());
+                baseModelBundles(), 
+                flowCapableModelBundles(), 
+                junitAndMockitoBundles());
     }
     
 }
index e46b566..54e1a06 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.sal.common.util;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -20,7 +21,7 @@ public class Rpcs {
         return ret;
     }
 
-    private static class RpcResultTO<T> implements RpcResult<T> {
+    private static class RpcResultTO<T> implements RpcResult<T>, Serializable {
 
         private final Collection<RpcError> errors;
         private final T result;
index 1fb73bc..99a38ca 100644 (file)
@@ -13,17 +13,24 @@ import java.util.Collections;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
-public abstract class AbstractConsumer implements Consumer, BundleActivator {
+public abstract class AbstractConsumer implements Consumer, BundleActivator,ServiceTrackerCustomizer<Broker, Broker> {
+
+    
+    
+    
+    private BundleContext context;
+    private ServiceTracker<Broker, Broker> tracker;
+    private Broker broker;
 
-    Broker broker;
-    ServiceReference<Broker> brokerRef;
     @Override
     public final void start(BundleContext context) throws Exception {
+        this.context = context;
         this.startImpl(context);
-        brokerRef = context.getServiceReference(Broker.class);
-        broker = context.getService(brokerRef);
-        broker.registerConsumer(this,context);
+        tracker = new ServiceTracker<>(context, Broker.class, this);
+        tracker.open();
     }
 
 
@@ -32,9 +39,7 @@ public abstract class AbstractConsumer implements Consumer, BundleActivator {
     public final void stop(BundleContext context) throws Exception {
         stopImpl(context);
         broker = null;
-        if(brokerRef != null) {
-            context.ungetService(brokerRef);
-        }
+        tracker.close();
     }
 
     protected void startImpl(BundleContext context) {
@@ -49,4 +54,25 @@ public abstract class AbstractConsumer implements Consumer, BundleActivator {
         return Collections.emptySet();
     }
 
+    
+    @Override
+    public Broker addingService(ServiceReference<Broker> reference) {
+        if(broker == null) {
+            broker = context.getService(reference);
+            broker.registerConsumer(this, context);
+            return broker;
+        }
+        
+        return null;
+    }
+    
+    @Override
+    public void modifiedService(ServiceReference<Broker> reference, Broker service) {
+        // NOOP
+    }
+    
+    @Override
+    public void removedService(ServiceReference<Broker> reference, Broker service) {
+        stopImpl(context);
+    }
 }
index 621ef92..1cb1a2b 100644 (file)
@@ -10,16 +10,20 @@ package org.opendaylight.controller.sal.core.api;
 import java.util.Collection;
 import java.util.Collections;
 
+import javax.naming.Context;
+
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
-public abstract class AbstractProvider implements BundleActivator, Provider {
+public abstract class AbstractProvider implements BundleActivator, Provider,ServiceTrackerCustomizer<Broker, Broker> {
 
-    private ServiceReference<Broker> brokerRef;
     private Broker broker;
-
+    private BundleContext context;
+    private ServiceTracker<Broker, Broker> tracker;
     @Override
     public Collection<ProviderFunctionality> getProviderFunctionality() {
         return Collections.emptySet();
@@ -27,12 +31,10 @@ public abstract class AbstractProvider implements BundleActivator, Provider {
 
     @Override
     public final void start(BundleContext context) throws Exception {
-        brokerRef = context.getServiceReference(Broker.class);
-        broker = context.getService(brokerRef);
-
+        this.context = context;
         this.startImpl(context);
-
-        broker.registerProvider(this,context);
+        tracker = new ServiceTracker<>(context, Broker.class, this);
+        tracker.open();
     }
 
     protected void startImpl(BundleContext context) {
@@ -44,7 +46,31 @@ public abstract class AbstractProvider implements BundleActivator, Provider {
 
     @Override
     public final void stop(BundleContext context) throws Exception {
+        broker = null;
+        tracker.close();
+        tracker = null;
         stopImpl(context);
     }
 
+    @Override
+    public Broker addingService(ServiceReference<Broker> reference) {
+        if(broker == null) {
+            broker = context.getService(reference);
+            broker.registerProvider(this, context);
+            return broker;
+        }
+        
+        return null;
+    }
+    
+    @Override
+    public void modifiedService(ServiceReference<Broker> reference, Broker service) {
+        // NOOP
+    }
+    
+    @Override
+    public void removedService(ServiceReference<Broker> reference, Broker service) {
+        stopImpl(context);
+    }
+    
 }
index 482cfa9..dc116ca 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
 import org.opendaylight.controller.sal.core.api.data.DataStore
 import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter
 import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener
+import org.opendaylight.controller.sal.dom.broker.impl.RpcRouterImpl
 
 class BrokerConfigActivator implements AutoCloseable {
     
@@ -37,7 +38,7 @@ class BrokerConfigActivator implements AutoCloseable {
         val emptyProperties = new Hashtable<String, String>();
         broker.setBundleContext(context);
         
-
+        broker.setRouter(new RpcRouterImpl("Rpc router"))
         schemaService = new SchemaServiceImpl();
         schemaService.setContext(context);
         schemaService.setParser(new YangParserImpl());
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml
new file mode 100644 (file)
index 0000000..b8e0938
--- /dev/null
@@ -0,0 +1,199 @@
+<?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.controller</groupId>
+        <artifactId>sal-parent</artifactId>
+        <relativePath>../..</relativePath>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>sal-remoterpc-connector</artifactId>
+    <packaging>bundle</packaging>
+
+  <properties>
+    <zeromq.version>0.3.1</zeromq.version>
+    <jackson.version>1.9.8</jackson.version>
+    <stax.version>1.0.1</stax.version>
+  </properties>
+
+  <dependencies>
+    <!-- MD Sal interdependencies -->
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>sal-core-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>sal-connector-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>sal-common-util</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>zeromq-routingtable.implementation</artifactId>
+      <!-- TODO: fix the version. Why is it not MD Sal project version?-->
+      <version>0.4.1-SNAPSHOT</version>
+    </dependency>
+
+    <!-- AD Sal -->
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+
+    <!-- Yang tools -->
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-common</artifactId>
+    </dependency>
+
+    <!-- Third Party -->
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.zeromq</groupId>
+      <artifactId>jeromq</artifactId>
+      <version>${zeromq.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+    <dependency>
+      <groupId> org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.jackson</groupId>
+      <artifactId>jackson-core-asl</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.jackson</groupId>
+      <artifactId>jackson-mapper-asl</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>stax</groupId>
+      <artifactId>stax-api</artifactId>
+      <version>${stax.version}</version>
+    </dependency>
+
+    <!-- Tests -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.powermock</groupId>
+      <artifactId>powermock-module-junit4</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.powermock</groupId>
+      <artifactId>powermock-api-mockito</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.powermock</groupId>
+      <artifactId>powermock-core</artifactId>
+    </dependency>
+
+  </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>${bundle.plugin.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            *,
+                            !org.codehaus.enunciate.jaxrs
+                        </Import-Package>
+                        <Export-Package>
+                            org.opendaylight.controller.config.yang.md.sal.remote.rpc,
+                            org.opendaylight.controller.sal.connector.remoterpc,
+                            org.opendaylight.controller.sal.connector.remoterpc.*
+                        </Export-Package>
+                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                    </instructions>
+                </configuration>
+            </plugin>
+           
+
+            <plugin>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+                <version>0.5.9-SNAPSHOT</version>
+                <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==org.opendaylight.controller.config.yang
+                                        </namespaceToPackage1>
+                                    </additionalConfiguration>
+                                </generator>
+                                <generator>
+                                    <codeGeneratorClass>org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl</codeGeneratorClass>
+                                    <outputBaseDir>target/site/models</outputBaseDir>
+                                </generator>
+                            </codeGenerators>
+                            <inspectDependencies>true</inspectDependencies>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.opendaylight.controller</groupId>
+                        <artifactId>yang-jmx-generator-plugin</artifactId>
+                        <version>0.2.3-SNAPSHOT</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.opendaylight.yangtools</groupId>
+                        <artifactId>maven-sal-api-gen-plugin</artifactId>
+                        <version>0.6.0-SNAPSHOT</version>
+                        <type>jar</type>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModule.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModule.java
new file mode 100644 (file)
index 0000000..606f282
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+* Generated file
+
+* Generated from: yang module name: odl-sal-dom-rpc-remote-cfg  yang module local name: remote-zeromq-rpc-server
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Dec 05 14:25:21 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.remote.rpc;
+
+import org.opendaylight.controller.sal.connector.remoterpc.Client;
+import org.opendaylight.controller.sal.connector.remoterpc.RemoteRpcProvider;
+import org.opendaylight.controller.sal.connector.remoterpc.RoutingTableProvider;
+import org.opendaylight.controller.sal.connector.remoterpc.ServerImpl;
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.osgi.framework.BundleContext;
+
+/**
+*
+*/
+public final class ZeroMQServerModule extends org.opendaylight.controller.config.yang.md.sal.remote.rpc.AbstractZeroMQServerModule
+ {
+
+    private static final Integer ZEROMQ_ROUTER_PORT = 5554;
+    private BundleContext bundleContext;
+
+    public ZeroMQServerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public ZeroMQServerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            ZeroMQServerModule oldModule, java.lang.AutoCloseable oldInstance) {
+
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    protected void customValidation(){
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        
+        Broker broker = getDomBrokerDependency();
+        RoutingTableProvider provider = new RoutingTableProvider(bundleContext);
+        
+        
+        final int port = getPort() != null ? getPort() : ZEROMQ_ROUTER_PORT;
+
+        ServerImpl serverImpl = new ServerImpl(port);
+        
+        Client clientImpl = new Client();
+        RemoteRpcProvider facade = new RemoteRpcProvider(serverImpl, clientImpl);
+        
+        facade.setRoutingTableProvider(provider );
+        
+        broker.registerProvider(facade, bundleContext);
+        return facade;
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModuleFactory.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModuleFactory.java
new file mode 100644 (file)
index 0000000..3cc3ac0
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+* Generated file
+
+* Generated from: yang module name: odl-sal-dom-rpc-remote-cfg  yang module local name: remote-zeromq-rpc-server
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Dec 05 14:25:21 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.remote.rpc;
+
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
+import org.opendaylight.controller.config.spi.Module;
+import org.osgi.framework.BundleContext;
+
+/**
+*
+*/
+public class ZeroMQServerModuleFactory extends org.opendaylight.controller.config.yang.md.sal.remote.rpc.AbstractZeroMQServerModuleFactory
+{
+
+    @Override
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
+        ZeroMQServerModule module = (ZeroMQServerModule) super.createModule(instanceName, dependencyResolver, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
+    
+    @Override
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+            DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
+        ZeroMQServerModule module = (ZeroMQServerModule) super.createModule(instanceName, dependencyResolver, old,bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/Client.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/Client.java
new file mode 100644 (file)
index 0000000..ef31623
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2013 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
+ */
+
+package org.opendaylight.controller.sal.connector.remoterpc;
+
+import com.google.common.base.Optional;
+
+import org.opendaylight.controller.sal.common.util.RpcErrors;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable;
+import org.opendaylight.controller.sal.connector.remoterpc.dto.Message;
+import org.opendaylight.controller.sal.connector.remoterpc.dto.MessageWrapper;
+import org.opendaylight.controller.sal.connector.remoterpc.dto.RouteIdentifierImpl;
+import org.opendaylight.controller.sal.connector.remoterpc.util.XmlUtils;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.zeromq.ZMQ;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.*;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * An implementation of {@link RpcImplementation} that makes remote RPC calls
+ */
+public class Client implements RemoteRpcClient {
+
+    private final Logger _logger = LoggerFactory.getLogger(Client.class);
+
+    private final LinkedBlockingQueue<MessageWrapper> requestQueue = new LinkedBlockingQueue<MessageWrapper>(100);
+
+    private final ExecutorService pool = Executors.newSingleThreadExecutor();
+    private final long TIMEOUT = 5000; // in ms
+
+    private  RoutingTableProvider routingTableProvider;
+
+    public RoutingTableProvider getRoutingTableProvider() {
+        return routingTableProvider;
+    }
+
+    public void setRoutingTableProvider(RoutingTableProvider routingTableProvider) {
+        this.routingTableProvider = routingTableProvider;
+    }
+
+    public LinkedBlockingQueue<MessageWrapper> getRequestQueue() {
+        return requestQueue;
+    }
+
+    @Override
+    public Set<QName> getSupportedRpcs() {
+        // TODO: Find the entries from routing table
+        return Collections.emptySet();
+    }
+
+    public void start() {
+        pool.execute(new Sender(this));
+
+    }
+
+    public void stop() {
+
+        _logger.debug("Client stopping...");
+        Context.getInstance().getZmqContext().term();
+        _logger.debug("ZMQ context terminated");
+
+        pool.shutdown(); // intiate shutdown
+        try {
+            if (!pool.awaitTermination(10, TimeUnit.SECONDS)) {
+                pool.shutdownNow();
+                if (!pool.awaitTermination(10, TimeUnit.SECONDS))
+                    _logger.error("Client thread pool did not shut down");
+            }
+        } catch (InterruptedException e) {
+            // (Re-)Cancel if current thread also interrupted
+            pool.shutdownNow();
+            // Preserve interrupt status
+            Thread.currentThread().interrupt();
+        }
+        _logger.debug("Client stopped");
+    }
+
+    @Override
+    public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input) {
+
+        RouteIdentifierImpl routeId = new RouteIdentifierImpl();
+        routeId.setType(rpc);
+
+        String address = lookupRemoteAddress(routeId);
+
+        Message request = new Message.MessageBuilder().type(Message.MessageType.REQUEST)
+                .sender(Context.getInstance().getLocalUri()).recipient(address).route(routeId)
+                .payload(XmlUtils.compositeNodeToXml(input)).build();
+
+        List<RpcError> errors = new ArrayList<RpcError>();
+
+        try (SocketPair pair = new SocketPair()) {
+
+            MessageWrapper messageWrapper = new MessageWrapper(request, pair.getSender());
+            process(messageWrapper);
+            Message response = parseMessage(pair.getReceiver());
+
+            CompositeNode payload = XmlUtils.xmlToCompositeNode((String) response.getPayload());
+
+            return Rpcs.getRpcResult(true, payload, errors);
+
+        } catch (Exception e) {
+            collectErrors(e, errors);
+            return Rpcs.getRpcResult(false, null, errors);
+        }
+
+    }
+
+    public void process(MessageWrapper msg) throws TimeoutException, InterruptedException {
+        _logger.debug("Processing message [{}]", msg);
+
+        boolean success = requestQueue.offer(msg, TIMEOUT, TimeUnit.MILLISECONDS);
+        if (!success)
+            throw new TimeoutException("Queue is full");
+    }
+
+    /**
+     * Block on socket for reply
+     * 
+     * @param receiver
+     * @return
+     */
+    private Message parseMessage(ZMQ.Socket receiver) throws IOException, ClassNotFoundException {
+        return (Message) Message.deserialize(receiver.recv());
+    }
+
+    /**
+     * Find address for the given route identifier in routing table
+     * 
+     * @param routeId
+     *            route identifier
+     * @return remote network address
+     */
+    private String lookupRemoteAddress(RpcRouter.RouteIdentifier routeId) {
+        checkNotNull(routeId, "route must not be null");
+
+        Optional<RoutingTable<String, String>> routingTable = routingTableProvider.getRoutingTable();
+        checkNotNull(routingTable.isPresent(), "Routing table is null");
+
+        Set<String> addresses = routingTable.get().getRoutes(routeId.toString());
+        checkNotNull(addresses, "Address not found for route [%s]", routeId);
+        checkState(addresses.size() == 1, "Multiple remote addresses found for route [%s], \nonly 1 expected", routeId); // its
+                                                                                                                         // a
+                                                                                                                         // global
+                                                                                                                         // service.
+
+        String address = addresses.iterator().next();
+        checkNotNull(address, "Address not found for route [%s]", routeId);
+
+        return address;
+    }
+
+    private void collectErrors(Exception e, List<RpcError> errors) {
+        if (e == null)
+            return;
+        if (errors == null)
+            errors = new ArrayList<RpcError>();
+
+        errors.add(RpcErrors.getRpcError(null, null, null, null, e.getMessage(), null, e.getCause()));
+        for (Throwable t : e.getSuppressed()) {
+            errors.add(RpcErrors.getRpcError(null, null, null, null, t.getMessage(), null, t));
+        }
+    }
+
+    @Override
+    public void close() throws Exception {
+        stop();
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/Context.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/Context.java
new file mode 100644 (file)
index 0000000..f0bf12c
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013 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
+ */
+
+package org.opendaylight.controller.sal.connector.remoterpc;
+
+import org.zeromq.ZMQ;
+
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.Enumeration;
+
+/**
+ * Provides a ZeroMQ Context object
+ */
+public class Context {
+  private ZMQ.Context zmqContext = ZMQ.context(1);
+  private String uri;
+
+  private static Context _instance = new Context();
+
+  private Context() {}
+
+  public static Context getInstance(){
+    return _instance;
+  }
+
+  public ZMQ.Context getZmqContext(){
+    return this.zmqContext;
+  }
+
+  public String getLocalUri(){
+    uri = (uri != null) ? uri
+            : new StringBuilder("tcp://").append(getIpAddress()).append(":")
+              .append(getRpcPort()).toString();
+
+    return uri;
+  }
+
+  public String getRpcPort(){
+    String rpcPort = (System.getProperty("rpc.port") != null)
+        ? System.getProperty("rpc.port")
+        : "5554";
+
+    return rpcPort;
+  }
+
+  private String getIpAddress(){
+    String ipAddress = (System.getProperty("local.ip") != null)
+        ? System.getProperty("local.ip")
+        : findIpAddress();
+
+    return ipAddress;
+  }
+
+  /**
+   * Finds IPv4 address of the local VM
+   * TODO: This method is non-deterministic. There may be more than one IPv4 address. Cant say which
+   * address will be returned. Read IP from a property file or enhance the code to make it deterministic.
+   * Should we use IP or hostname?
+   *
+   * @return
+   */
+  private String findIpAddress() {
+    String hostAddress = null;
+    Enumeration e = null;
+    try {
+      e = NetworkInterface.getNetworkInterfaces();
+    } catch (SocketException e1) {
+      e1.printStackTrace();
+    }
+    while (e.hasMoreElements()) {
+
+      NetworkInterface n = (NetworkInterface) e.nextElement();
+
+      Enumeration ee = n.getInetAddresses();
+      while (ee.hasMoreElements()) {
+        InetAddress i = (InetAddress) ee.nextElement();
+        if ((i instanceof Inet4Address) && (i.isSiteLocalAddress()))
+          hostAddress = i.getHostAddress();
+      }
+    }
+    return hostAddress;
+
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcClient.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcClient.java
new file mode 100644 (file)
index 0000000..6bd123b
--- /dev/null
@@ -0,0 +1,13 @@
+package org.opendaylight.controller.sal.connector.remoterpc;
+
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+
+public interface RemoteRpcClient extends RpcImplementation,AutoCloseable{
+
+
+    void setRoutingTableProvider(RoutingTableProvider provider);
+    
+    void stop();
+    
+    void start();
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcProvider.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcProvider.java
new file mode 100644 (file)
index 0000000..3c2e3b0
--- /dev/null
@@ -0,0 +1,95 @@
+package org.opendaylight.controller.sal.connector.remoterpc;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+
+import org.opendaylight.controller.sal.connector.remoterpc.Client;
+import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.Provider;
+import org.opendaylight.controller.sal.core.api.Provider.ProviderFunctionality;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+
+public class RemoteRpcProvider implements 
+    RemoteRpcServer,
+    RemoteRpcClient,
+    Provider {
+
+    private final ServerImpl server;
+    private final Client client;
+    private RoutingTableProvider provider;
+
+    @Override
+    public void setRoutingTableProvider(RoutingTableProvider provider) {
+        this.provider = provider;
+        server.setRoutingTableProvider(provider);
+        client.setRoutingTableProvider(provider);
+    }
+    
+    @Override
+    public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input) {
+        return client.invokeRpc(rpc, input);
+    }
+    
+    @Override
+    public Set<QName> getSupportedRpcs() {
+        return client.getSupportedRpcs();
+    }
+    
+    
+    public RemoteRpcProvider(ServerImpl server, Client client) {
+        this.server = server;
+        this.client = client;
+    }
+    
+    public void setBrokerSession(ProviderSession session) {
+        server.setBrokerSession(session);
+    }
+    public void setServerPool(ExecutorService serverPool) {
+        server.setServerPool(serverPool);
+    }
+    public void start() {
+        client.setRoutingTableProvider(provider);
+        server.setRoutingTableProvider(provider);
+        server.start();
+        client.start();
+    }
+    public void onRouteUpdated(String key, Set values) {
+        server.onRouteUpdated(key, values);
+    }
+    public void onRouteDeleted(String key) {
+        server.onRouteDeleted(key);
+    }
+    
+    
+    @Override
+    public Collection<ProviderFunctionality> getProviderFunctionality() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    
+    @Override
+    public void onSessionInitiated(ProviderSession session) {
+        server.setBrokerSession(session);
+        start();
+    }
+    
+    
+    public void close() throws Exception {
+        server.close();
+        client.close();
+    }
+
+    
+    
+    
+    @Override
+    public void stop() {
+        server.stop();
+        client.stop();
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcServer.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RemoteRpcServer.java
new file mode 100644 (file)
index 0000000..932600f
--- /dev/null
@@ -0,0 +1,6 @@
+package org.opendaylight.controller.sal.connector.remoterpc;
+
+
+public interface RemoteRpcServer extends AutoCloseable {
+
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java
new file mode 100644 (file)
index 0000000..cfdf986
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.sal.connector.remoterpc;
+
+import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+import com.google.common.base.Optional;
+
+public class RoutingTableProvider implements AutoCloseable {
+
+    @SuppressWarnings("rawtypes")
+    final ServiceTracker<RoutingTable,RoutingTable> tracker;
+    
+    
+    public RoutingTableProvider(BundleContext ctx) {
+        @SuppressWarnings("rawtypes")
+        ServiceTracker<RoutingTable, RoutingTable> rawTracker = new ServiceTracker<>(ctx, RoutingTable.class, null);
+        tracker = rawTracker;
+        tracker.open();
+    }
+    
+    public Optional<RoutingTable<String, String>> getRoutingTable() {
+        @SuppressWarnings("unchecked")
+        RoutingTable<String,String> tracked = tracker.getService();
+        return Optional.fromNullable(tracked);
+    }
+
+    @Override
+    public void close() throws Exception {
+        tracker.close();
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RpcSocket.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RpcSocket.java
new file mode 100644 (file)
index 0000000..7e8590a
--- /dev/null
+++ b/