Merge "Add test for generated code checking list of dependencies."
authorEd Warnicke <eaw@cisco.com>
Fri, 10 Jan 2014 17:10:53 +0000 (17:10 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 10 Jan 2014 17:10:53 +0000 (17:10 +0000)
253 files changed:
.gitreview [new file with mode: 0644]
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManager.java
opendaylight/clustering/stub/src/main/java/org/opendaylight/controller/clustering/stub/internal/ClusterManagerCommon.java
opendaylight/commons/opendaylight/pom.xml
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java
opendaylight/config/pom.xml
opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTracker.java
opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/MbeParser.java
opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangParserWrapper.java [new file with mode: 0644]
opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AbstractScheme.java
opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/ContainerFlowConfig.java
opendaylight/distribution/opendaylight/opendaylight.target
opendaylight/distribution/opendaylight/pom.xml
opendaylight/distribution/opendaylight/src/assemble/bin.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/RSA.pk [moved from opendaylight/netconf/netconf-ssh/src/main/resources/RSA.pk with 100% similarity]
opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini
opendaylight/distribution/opendaylight/src/main/resources/run.sh
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntry.java
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java
opendaylight/hosttracker/implementation/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerTest.java
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend
opendaylight/md-sal/compatibility/sal-compatibility/pom.xml
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/DataPacketAdapter.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend
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/MDSalNodeConnectorFactory.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowStatisticsAdapter.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyAdapter.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyCommitHandler.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyMapping.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransaction.xtend
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransaction.xtend
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransaction.xtend
opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.xtend
opendaylight/md-sal/model/model-flow-base/pom.xml
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/meter-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-flow-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/port-types.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/flow-capable-transaction.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/flow-service.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/group-service.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/meter-service.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/port-service.yang
opendaylight/md-sal/model/model-flow-statistics/src/main/yang/flow-statistics.yang
opendaylight/md-sal/model/model-flow-statistics/src/main/yang/port-statistics.yang
opendaylight/md-sal/model/model-topology/src/main/yang/opendaylight-topology-inventory.yang
opendaylight/md-sal/model/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RuntimeCodeGenerator.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRouterCodegenInstance.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/XtendHelper.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/TransformerGenerator.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/PutAugmentationTest.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/TypeSafeDataReader.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountInstance.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionInstance.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/yangtools/yang/util/YangSchemaUtils.java
opendaylight/md-sal/sal-netconf-connector/pom.xml
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/XmlDocumentUtils.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/YangModelInputStreamAdapter.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang
opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/dto/RouteIdentifierImpl.java
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/RouteIdentifierImplTest.java
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/src/test/java/org/opendaylight/controller/sample/zeromq/test/it/RouterTest.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.xtend
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java [moved from opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/ToJsonBasicYangTypesTest.java with 90% similarity]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java [moved from opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/ToJsonChoiceCaseTest.java with 86% similarity]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonBasicDataTypesTest.java [moved from opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/ToJsonBasicDataTypesTest.java with 56% similarity]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIdentityrefTest.java [moved from opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/ToJsonIdentityrefTest.java with 56% similarity]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIncorrectTopLevelTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithAugmentTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/ToJsonLeafrefType.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/ToJsonWithAugmentTest.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlNotExistingLeafTypeTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithChoiceTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonIdentityrefToCnSnTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonLeafrefToCnSnTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ControllerContextTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyType.java [new file with mode: 0644]
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/ReadConfAndOperDataTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestCodecExceptionsTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlProvidersTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlAndDataSchemaLoader.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlLeafrefToCnSnTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/invalid-top-level-element/invalid-top-level-element.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/list/list-types-module [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-xml/choice/module-with-choice.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-xml/yang/basic-module.yang
opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/leafref/json/data.json [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/leafref/leafref-module [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/simple-list-yang/1/simple-list1.yang [moved from opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/simple-list-yang/simple-list1.yang with 100% similarity]
opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/simple-list-yang/2/simple-list2.yang [moved from opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/simple-list-yang/simple-list2.yang with 100% similarity]
opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/unsupported-json-format.json [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/leafref/leafref-module [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/leafref/xml/data.xml [new file with mode: 0644]
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsManagerActivator.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java
opendaylight/md-sal/test/sal-rest-connector-it/pom.xml
opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java
opendaylight/md-sal/topology-lldp-discovery/pom.xml [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java [new file with mode: 0644]
opendaylight/md-sal/topology-manager/pom.xml
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableNodeMapping.xtend
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.xtend
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyProvider.xtend [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributesConstants.java [deleted file]
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/mapping/ObjectMapper.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/ObjectNameAttributeMappingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/ObjectNameAttributeResolvingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/ObjectResolver.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/Config.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/InstanceConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/InstanceConfigElementResolved.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/ModuleConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/ModuleElementDefinition.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/ServiceRegistryWrapper.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/Services.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/InstanceRuntime.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/ModuleRuntime.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/Runtime.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/AbstractEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/DeleteEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfigXmlParser.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditStrategyType.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/MergeEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/MissingInstanceHandlingStrategy.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/NoneEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/RemoveEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/ReplaceEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/get/Get.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpc.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/util/Util.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/NetconfMappingTest.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfigTest.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/Util.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/PropertiesProviderBaseImpl.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/CapabilityProviderImpl.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfMonitoringServiceImpl.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationRouterImpl.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/NetconfUtil.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java
opendaylight/netconf/netconf-it/src/test/resources/RSA.pk [new file with mode: 0644]
opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/HandlingPriority.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/osgi/NetconfSSHActivator.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProvider.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProviderInterface.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/SSHServerTest.java
opendaylight/netconf/netconf-ssh/src/test/resources/RSA.pk [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/editConfig_addServiceNameOnTest.xml [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/editConfig_expectedResult.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/editConfig_none.xml
opendaylight/netconf/pom.xml
opendaylight/northbound/bundlescanner/implementation/pom.xml
opendaylight/northbound/commons/pom.xml
opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/JacksonJsonProcessingExceptionMapper.java
opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java
opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/exception/CommonsNorthboundExceptionTest.java
opendaylight/northbound/connectionmanager/pom.xml
opendaylight/northbound/containermanager/pom.xml
opendaylight/northbound/containermanager/src/main/java/org/opendaylight/controller/containermanager/northbound/ContainerManagerNorthboundRSApplication.java
opendaylight/northbound/controllermanager/pom.xml
opendaylight/northbound/controllermanager/src/main/java/org/opendaylight/controller/controllermanager/northbound/ControllerProperties.java
opendaylight/northbound/flowprogrammer/pom.xml
opendaylight/northbound/hosttracker/pom.xml
opendaylight/northbound/integrationtest/pom.xml
opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java
opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml
opendaylight/northbound/networkconfiguration/neutron/pom.xml
opendaylight/northbound/staticrouting/pom.xml
opendaylight/northbound/statistics/pom.xml
opendaylight/northbound/subnets/pom.xml
opendaylight/northbound/switchmanager/pom.xml
opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/NodeConnectorProperties.java
opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/NodeProperties.java
opendaylight/northbound/topology/pom.xml
opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/EdgeProperties.java
opendaylight/northbound/usermanager/pom.xml
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ComponentActivatorAbstractBase.java
opendaylight/samples/loadbalancer/src/test/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerTest.java
opendaylight/samples/northbound/loadbalancer/pom.xml
opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/internal/SimpleForwardingImpl.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java
opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SubnetTest.java
opendaylight/topologymanager/implementation/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java
opendaylight/web/devices/pom.xml
opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java
opendaylight/web/flows/pom.xml
opendaylight/web/root/pom.xml
opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWeb.java
opendaylight/web/root/src/main/resources/WEB-INF/web.xml
opendaylight/web/topology/pom.xml
opendaylight/web/troubleshoot/pom.xml

diff --git a/.gitreview b/.gitreview
new file mode 100644 (file)
index 0000000..5c4f71d
--- /dev/null
@@ -0,0 +1,4 @@
+[gerrit]
+host=git.opendaylight.org
+port=29418
+project=controller.git
index fcf71a9..65e7720 100644 (file)
@@ -68,7 +68,7 @@ public class ClusterManager implements IClusterServices {
     private HashSet<IListenRoleChange> roleChangeListeners;
     private ViewChangedListener cacheManagerListener;
 
-    private static String loopbackAddress = "127.0.0.1";
+    private static String loopbackAddress = InetAddress.getLoopbackAddress().getHostAddress();
 
     // defaultTransactionTimeout is 60 seconds
     private static int DEFAULT_TRANSACTION_TIMEOUT = 60;
index fe73e24..f27e6f0 100644 (file)
@@ -43,7 +43,7 @@ public abstract class ClusterManagerCommon implements IClusterServicesCommon {
     private ConcurrentMap<String, ConcurrentMap<?, ?>> caches = new ConcurrentHashMap<String, ConcurrentMap<?, ?>>();
 
     protected ClusterManagerCommon() throws UnknownHostException {
-        loopbackAddress = InetAddress.getByName("127.0.0.1");
+        loopbackAddress = InetAddress.getLoopbackAddress();
     }
 
     /**
index 5183165..8933b14 100644 (file)
@@ -46,7 +46,7 @@
     <sonar.skippedModules>org.openflow.openflowj,net.sf.jung2</sonar.skippedModules>
     <logback.version>1.0.9</logback.version>
     <slf4j.version>1.7.2</slf4j.version>
-    <jackson.version>1.9.8</jackson.version>
+    <jackson.version>2.3.0</jackson.version>
     <spring.version>3.1.3.RELEASE</spring.version>
     <spring-security.version>3.1.3.RELEASE</spring-security.version>
     <spring-osgi.version>1.2.1</spring-osgi.version>
     <jolokia.bridge.version>0.0.1-SNAPSHOT</jolokia.bridge.version>
     <netty.version>4.0.10.Final</netty.version>
     <commons.io.version>2.4</commons.io.version>
-    <!-- Sonar properties using jacoco to retrieve integration test results -->
-    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
-    <sonar.language>java</sonar.language>
+    <bundlescanner.version>0.4.1-SNAPSHOT</bundlescanner.version>
+    <usermanager.version>0.4.1-SNAPSHOT</usermanager.version>
     <forwardingrulesmanager.version>0.5.0-SNAPSHOT</forwardingrulesmanager.version>
     <statisticsmanager.version>0.5.0-SNAPSHOT</statisticsmanager.version>
     <clustering.services.version>0.5.0-SNAPSHOT</clustering.services.version>
+    <configuration.version>0.4.1-SNAPSHOT</configuration.version>
+    <topologymanager.version>0.4.1-SNAPSHOT</topologymanager.version>
+    <!-- Third party version -->
+    <jersey-servlet.version>1.18-SNAPSHOT</jersey-servlet.version>
+    <corsfilter.version>7.0.43-SNAPSHOT</corsfilter.version>
+    <!-- Northbound API version -->
+    <commons.northbound.version>0.4.1-SNAPSHOT</commons.northbound.version>
+    <!-- Sonar properties using jacoco to retrieve integration test results -->
+    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
+    <sonar.language>java</sonar.language>
     <maven.compile.plugin.version>2.5.1</maven.compile.plugin.version>
     <java.version.source>1.7</java.version.source>
     <java.version.target>1.7</java.version.target>
         <artifactId>logback-classic</artifactId>
         <version>${logback.version}</version>
       </dependency>
-      <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-mapper-asl</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-core-asl</artifactId>
+
+     <dependency>
+       <groupId>com.fasterxml.jackson.core</groupId>
+       <artifactId>jackson-annotations</artifactId>
+       <version>${jackson.version}</version>
+     </dependency>
+
+     <dependency>
+       <groupId>com.fasterxml.jackson.core</groupId>
+       <artifactId>jackson-core</artifactId>
+       <version>${jackson.version}</version>
+     </dependency>
+
+     <dependency>
+       <groupId>com.fasterxml.jackson.core</groupId>
+       <artifactId>jackson-databind</artifactId>
+       <version>${jackson.version}</version>
+     </dependency>
+
+     <dependency>
+        <groupId>com.fasterxml.jackson.jaxrs</groupId>
+        <artifactId>jackson-jaxrs-base</artifactId>
         <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-jaxrs</artifactId>
+     </dependency>
+
+    <dependency>
+        <groupId>com.fasterxml.jackson.jaxrs</groupId>
+        <artifactId>jackson-jaxrs-json-provider</artifactId>
         <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-xc</artifactId>
+     </dependency>
+
+     <dependency>
+        <groupId>com.fasterxml.jackson.module</groupId>
+        <artifactId>jackson-module-jaxb-annotations</artifactId>
         <version>${jackson.version}</version>
-      </dependency>
+     </dependency>
+
       <dependency>
         <groupId>org.codehaus.jettison</groupId>
         <artifactId>jettison</artifactId>
         <artifactId>jersey-client</artifactId>
         <version>${jersey.version}</version>
       </dependency>
-      <dependency>
-        <groupId>com.sun.jersey</groupId>
-        <artifactId>jersey-json</artifactId>
-        <version>${jersey.version}</version>
-      </dependency>
+
       <dependency>
         <groupId>org.ow2.asm</groupId>
         <artifactId>asm-all</artifactId>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
         <artifactId>com.sun.jersey.jersey-servlet</artifactId>
-        <version>1.17</version>
+        <version>${jersey-servlet.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
         <artifactId>org.apache.catalina.filters.CorsFilter</artifactId>
-        <version>7.0.42</version>
+        <version>${corsfilter.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>switchmanager</artifactId>
-        <version>0.5.1-SNAPSHOT</version>
+        <version>${switchmanager.api.version}</version>
       </dependency>
 
       <!-- equinox http service bridge -->
index fa9e0f1..028d7d1 100644 (file)
@@ -7,8 +7,12 @@
  */
 package org.opendaylight.controller.config.manager.impl;
 
+import com.google.common.base.Preconditions;
+import junit.framework.Assert;
 import org.junit.After;
 import org.mockito.Matchers;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.config.api.jmx.CommitStatus;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.ModuleFactoriesResolver;
 import org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator;
@@ -21,19 +25,26 @@ import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import java.io.Closeable;
+import java.io.InputStream;
 import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Dictionary;
+import java.util.List;
 import java.util.Set;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
 /**
@@ -55,6 +66,18 @@ public abstract class AbstractConfigTest extends
     protected BundleContext mockedContext = mock(BundleContext.class);
     protected ServiceRegistration<?> mockedServiceRegistration;
 
+    private static final Logger logger = LoggerFactory.getLogger(AbstractConfigTest.class);
+
+    // Default handler for OSGi service registration
+    private static final BundleContextServiceRegistrationHandler noopServiceRegHandler = new BundleContextServiceRegistrationHandler() {
+        @Override
+        public void handleServiceRegistration(Object serviceInstance) {}
+    };
+
+    protected BundleContextServiceRegistrationHandler getBundleContextServiceRegistrationHandler(Class<?> serviceType) {
+        return noopServiceRegHandler;
+    }
+
     // this method should be called in @Before
     protected void initConfigTransactionManagerImpl(
             ModuleFactoriesResolver resolver) {
@@ -63,17 +86,14 @@ public abstract class AbstractConfigTest extends
 
         configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(
                 platformMBeanServer);
-        this.mockedServiceRegistration = mock(ServiceRegistration.class);
-        doNothing().when(mockedServiceRegistration).unregister();
-        doReturn(mockedServiceRegistration).when(mockedContext).registerService(
-                Matchers.any(String[].class), any(Closeable.class),
-                any(Dictionary.class));
+        initBundleContext();
 
         internalJmxRegistrator = new InternalJMXRegistrator(platformMBeanServer);
         baseJmxRegistrator = new BaseJMXRegistrator(internalJmxRegistrator);
 
         configRegistry = new ConfigRegistryImpl(resolver,
                 platformMBeanServer, baseJmxRegistrator);
+
         try {
             configRegistryJMXRegistrator.registerToJMX(configRegistry);
         } catch (InstanceAlreadyExistsException e) {
@@ -82,6 +102,35 @@ public abstract class AbstractConfigTest extends
         configRegistryClient = new ConfigRegistryJMXClient(platformMBeanServer);
     }
 
+    private void initBundleContext() {
+        this.mockedServiceRegistration = mock(ServiceRegistration.class);
+        doNothing().when(mockedServiceRegistration).unregister();
+
+        RegisterServiceAnswer answer = new RegisterServiceAnswer();
+
+        doAnswer(answer).when(mockedContext).registerService(Matchers.any(String[].class),
+                any(Closeable.class), Matchers.<Dictionary<String, ?>>any());
+        doAnswer(answer).when(mockedContext).registerService(Matchers.<Class<Closeable>>any(), any(Closeable.class),
+                Matchers.<Dictionary<String, ?>>any());
+    }
+
+
+    public Collection<InputStream> getFilesAsInputStreams(List<String> paths) {
+        final Collection<InputStream> resources = new ArrayList<>();
+        List<String> failedToFind = new ArrayList<>();
+        for (String path : paths) {
+            InputStream resourceAsStream = getClass().getResourceAsStream(path);
+            if (resourceAsStream == null) {
+                failedToFind.add(path);
+            } else {
+                resources.add(resourceAsStream);
+            }
+        }
+        Assert.assertEquals("Some files were not found", Collections.<String>emptyList(), failedToFind);
+
+        return resources;
+    }
+
     @After
     public final void cleanUpConfigTransactionManagerImpl() {
         configRegistryJMXRegistrator.close();
@@ -125,9 +174,8 @@ public abstract class AbstractConfigTest extends
     protected ObjectName createTestConfigBean(
             ConfigTransactionJMXClient transaction, String implementationName,
             String name) throws InstanceAlreadyExistsException {
-        ObjectName nameCreated = transaction.createModule(implementationName,
+        return transaction.createModule(implementationName,
                 name);
-        return nameCreated;
     }
 
     protected void assertBeanCount(int i, String configMXBeanName) {
@@ -154,4 +202,51 @@ public abstract class AbstractConfigTest extends
             Class<? extends Module> configBeanClass, String implementationName) {
         return new ClassBasedModuleFactory(implementationName, configBeanClass);
     }
+
+
+    public static interface BundleContextServiceRegistrationHandler {
+
+       void handleServiceRegistration(Object serviceInstance);
+
+    }
+
+    private class RegisterServiceAnswer implements Answer {
+
+        @Override
+        public Object answer(InvocationOnMock invocation) throws Throwable {
+            Object[] args = invocation.getArguments();
+
+            Preconditions.checkArgument(args.length == 3, "Unexpected arguments size (expected 3 was %s)", args.length);
+
+            Object serviceTypeRaw = args[0];
+            Object serviceInstance = args[1];
+
+            if (serviceTypeRaw instanceof Class) {
+                Class<?> serviceType = (Class<?>) serviceTypeRaw;
+                invokeServiceHandler(serviceInstance, serviceType);
+
+            } else if(serviceTypeRaw instanceof String[]) {
+                for (String className : (String[]) serviceTypeRaw) {
+                    try {
+                        Class<?> serviceType = Class.forName(className);
+                        invokeServiceHandler(serviceInstance, serviceType);
+                    } catch (ClassNotFoundException e) {
+                        logger.warn("Not handling service registration of type {} ", className, e);
+                    }
+                }
+
+            } else
+                logger.debug("Not handling service registration of type {}, Unknown type", serviceTypeRaw);
+
+            return mockedServiceRegistration;
+        }
+
+        private void invokeServiceHandler(Object serviceInstance, Class<?> serviceType) {
+            BundleContextServiceRegistrationHandler serviceRegistrationHandler = getBundleContextServiceRegistrationHandler(serviceType);
+
+            if (serviceRegistrationHandler != null) {
+                serviceRegistrationHandler.handleServiceRegistration(serviceType.cast(serviceInstance));
+            }
+        }
+    }
 }
index eba5e07..9f9bca9 100644 (file)
@@ -61,7 +61,7 @@
         <java.version.source>1.7</java.version.source>
         <java.version.target>1.7</java.version.target>
         <junit.version>4.10</junit.version>
-        <maven.bundle.version>2.3.7</maven.bundle.version>
+        <maven.bundle.version>2.4.0</maven.bundle.version>
         <osgi.version>5.0.0</osgi.version>
         <jacoco.version>0.6.2.201302030002</jacoco.version>
         <slf4j.version>1.7.2</slf4j.version>
index 9356dd3..0d704a8 100644 (file)
@@ -186,7 +186,15 @@ public class ExtenderYangTracker extends BundleTracker<Object> implements YangSt
                     yangStoreSnapshot.countModuleMXBeanEntries(), multimap.values().size());
             return yangStoreSnapshot;
         } catch (RuntimeException e) {
-            throw new YangStoreException("Unable to parse yang files from following URLs: " + multimap, e);
+            StringBuffer causeStr = new StringBuffer();
+            Throwable cause = e;
+            while (cause != null) {
+                causeStr.append(e.getMessage());
+                causeStr.append("\n");
+                cause = e.getCause();
+            }
+            throw new YangStoreException("Unable to parse yang files. \n" + causeStr.toString() +
+                    "URLs: " + multimap, e);
         }
     }
 
index 211da6b..2be6c81 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.config.yang.store.impl;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 import org.apache.commons.io.IOUtils;
 import org.opendaylight.controller.config.yang.store.api.YangStoreException;
 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
@@ -22,13 +21,10 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -37,26 +33,11 @@ public class MbeParser {
     public YangStoreSnapshotImpl parseYangFiles(
             Collection<? extends InputStream> allInput)
             throws YangStoreException {
-        YangParserImpl parser = new YangParserImpl();
+        YangParserImpl parser = YangParserWrapper.getYangParserInstance();
 
-        List<InputStream> bufferedInputStreams = new ArrayList<>();
-        for (InputStream is : allInput) {
-            String content;
-            try {
-                content = IOUtils.toString(is);
-            } catch (IOException e) {
-                throw new YangStoreException("Can not get yang as String from "
-                        + is, e);
-            }
-            InputStream buf = new ByteArrayInputStream(content.getBytes());
-            bufferedInputStreams.add(buf);
-        }
-
-        Map<InputStream, Module> allYangModules = parser
-                .parseYangModelsFromStreamsMapped(bufferedInputStreams);
+        Map<InputStream, Module> allYangModules = YangParserWrapper.parseYangFiles(parser, allInput);
 
-        SchemaContext resolveSchemaContext = parser.resolveSchemaContext(Sets
-                .newHashSet(allYangModules.values()));
+        SchemaContext resolveSchemaContext = YangParserWrapper.getSchemaContextFromModules(parser, allYangModules);
 
         // JMX generator
 
@@ -115,7 +96,7 @@ public class MbeParser {
 
     public Map<Module, String> parseYangFilesToString(
             Collection<? extends InputStream> allYangs) {
-        YangParserImpl parser = new YangParserImpl();
+        YangParserImpl parser = YangParserWrapper.getYangParserInstance();
 
         Map<InputStream, Module> allYangModules = parser
                 .parseYangModelsFromStreamsMapped(Lists.newArrayList(allYangs));
diff --git a/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangParserWrapper.java b/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangParserWrapper.java
new file mode 100644 (file)
index 0000000..7c42818
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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.config.yang.store.impl;
+
+import com.google.common.collect.Sets;
+import org.apache.commons.io.IOUtils;
+import org.opendaylight.controller.config.yang.store.api.YangStoreException;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class YangParserWrapper {
+
+    /**
+     * throw IllegalStateException if it is unable to parse yang files
+     */
+    public static SchemaContext parseYangFiles(Collection<? extends InputStream> yangFilesAsInputStreams) {
+        YangParserImpl parser = getYangParserInstance();
+        Map<InputStream, Module> mappedYangModules = null;
+        try {
+            mappedYangModules = parseYangFiles(parser, yangFilesAsInputStreams);
+        } catch (YangStoreException e) {
+            throw new IllegalStateException("Unable to parse yang files", e);
+        }
+        return getSchemaContextFromModules(parser, mappedYangModules);
+    }
+
+    static YangParserImpl getYangParserInstance() {
+        return new YangParserImpl();
+    }
+
+    static SchemaContext getSchemaContextFromModules(YangModelParser parser, Map<InputStream, Module> allYangModules) {
+        return parser.resolveSchemaContext(Sets
+                .newHashSet(allYangModules.values()));
+    }
+
+    static Map<InputStream, Module> parseYangFiles(YangModelParser parser, Collection<? extends InputStream> allInput) throws YangStoreException {
+        List<InputStream> bufferedInputStreams = new ArrayList<>();
+        for (InputStream is : allInput) {
+            String content;
+            try {
+                content = IOUtils.toString(is);
+            } catch (IOException e) {
+                throw new YangStoreException("Can not get yang as String from "
+                        + is, e);
+            }
+            InputStream buf = new ByteArrayInputStream(content.getBytes());
+            bufferedInputStreams.add(buf);
+        }
+
+        return parser
+                .parseYangModelsFromStreamsMapped(bufferedInputStreams);
+    }
+}
index 5ba156e..718a3ff 100644 (file)
@@ -277,6 +277,11 @@ public abstract class AbstractScheme {
 
     public Status addNode (Node node, InetAddress controller) {
         if (node == null || controller == null) {
+            if (node == null) {
+                log.warn("addNode: node is null");
+            } else if (controller == null) {
+                log.error("Failed to add node {}. The controller address retrieved from clusterServices is null.", node);
+            }
             return new Status(StatusCode.BADREQUEST);
         }
         if (isLocal(node))  {
index 9740a92..9d65ad3 100644 (file)
@@ -15,7 +15,9 @@ import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -308,9 +310,10 @@ public class ContainerFlowConfig implements Serializable {
     }
 
     /**
-     * Match Source IP Address.
+     * Match the set of these vlans with that of flowSpec's vlans.
      *
-     * @param flowSpec Flow Specification
+     * @param flowSpec
+     *            Flow Specification
      * @return true, if successful
      */
     private boolean matchDlVlan(ContainerFlowConfig flowSpec) {
@@ -320,7 +323,8 @@ public class ContainerFlowConfig implements Serializable {
         if (dlVlan == null || flowSpec.dlVlan == null) {
             return false;
         }
-        return dlVlan.equals(flowSpec.dlVlan);
+
+        return this.getVlanList().equals(flowSpec.getVlanList());
     }
 
     /**
@@ -404,18 +408,34 @@ public class ContainerFlowConfig implements Serializable {
     }
 
     /**
-     * Returns the vlan id number
+     * Returns the vlan id number for all vlans specified
      *
-     * @return the vlan id number
+     * @return the vlan id number for all vlans specified
      */
-    public Short getVlanId() {
-        Short vlan = 0;
+    public Set<Short> getVlanList() {
+        /*
+         * example: Vlan = "1,3,5-12"
+         * elemArray = ["1" "3" "5-12"]
+         * elem[2] = "5-12" --> limits = ["5" "12"]
+         * vlanList = [1 3 5 6 7 8 9 10 11 12]
+         */
+        Set<Short> vlanList = new HashSet<Short>();
         try {
-            vlan = Short.parseShort(dlVlan);
+            String[] elemArray = dlVlan.split(",");
+            for (String elem : elemArray) {
+                if (elem.contains("-")) {
+                    String[] limits = elem.split("-");
+                    for (short j = Short.valueOf(limits[0]); j <= Short.valueOf(limits[1]); j++) {
+                        vlanList.add(Short.valueOf(j));
+                    }
+                } else {
+                    vlanList.add(Short.valueOf(elem));
+                }
+            }
         } catch (NumberFormatException e) {
 
         }
-        return vlan;
+        return vlanList;
     }
 
     /**
@@ -617,13 +637,25 @@ public class ContainerFlowConfig implements Serializable {
         if (dlVlan != null) {
             short vlanId = 0;
             try {
-                vlanId = Short.parseShort(dlVlan);
+                String[] elemArray = dlVlan.split(",");
+                for (String elem : elemArray) {
+                    if (elem.contains("-")) {
+                        String[] limits = elem.split("-");
+                        if (Short.parseShort(limits[0]) < 0
+                                || Short.parseShort(limits[0]) >= Short.parseShort(limits[1])
+                                || Short.parseShort(limits[1]) > 0xfff) {
+                            return new Status(StatusCode.BADREQUEST, "Invalid vlan id");
+                        }
+                    } else {
+                        vlanId = Short.parseShort(elem);
+                        if (vlanId < 0 || vlanId > 0xfff) {
+                            return new Status(StatusCode.BADREQUEST, "Invalid vlan id");
+                        }
+                    }
+                }
             } catch (NumberFormatException e) {
                 return new Status(StatusCode.BADREQUEST, "Invalid vlan id");
             }
-            if (vlanId < 0 || vlanId > 0xfff) {
-                return new Status(StatusCode.BADREQUEST, "Invalid vlan id");
-            }
         }
         return new Status(StatusCode.SUCCESS);
     }
@@ -706,20 +738,46 @@ public class ContainerFlowConfig implements Serializable {
 
     /**
      * Returns the matches.
-     * If unidirectional flag is set, there will be only one match in the list
-     * If unidirectional flag is unset there will be two matches in the list,
+     * If unidirectional flag is set, there will be only one match per vlan in the list
+     * If unidirectional flag is unset there will be two matches per vlan in the list,
      * only if the specified flow has an intrinsic direction.
      * For Ex. if the cFlow only has the protocol field configured, no matter
-     * if unidirectional flag is set or not, only one match will be returned
+     * if unidirectional flag is set or not, only one match per vlan will be returned
      * The client just has to iterate over the returned list
      * @return the matches
      */
     public List<Match> getMatches() {
         List<Match> matches = new ArrayList<Match>();
-        Match match = new Match();
 
         if (this.dlVlan != null && !this.dlVlan.isEmpty()) {
-            match.setField(MatchType.DL_VLAN, this.getVlanId());
+            for(Short vlan:getVlanList()){
+                Match match = getMatch(vlan);
+                matches.add(match);
+            }
+        }
+        else{
+            Match match = getMatch(null);
+            matches.add(match);
+        }
+
+        if (!ContainerFlowConfig.unidirectional) {
+            List<Match> forwardMatches = new ArrayList<Match>(matches);
+            for (Match match : forwardMatches) {
+                Match reverse = match.reverse();
+                if (!match.equals(reverse)) {
+                    matches.add(reverse);
+                }
+            }
+        }
+
+        return matches;
+    }
+
+    private Match getMatch(Short vlan){
+        Match match = new Match();
+
+        if (vlan != null) {
+            match.setField(MatchType.DL_VLAN, vlan);
         }
         if (this.nwSrc != null && !this.nwSrc.trim().isEmpty()) {
             String parts[] = this.nwSrc.split("/");
@@ -756,15 +814,7 @@ public class ContainerFlowConfig implements Serializable {
         if (this.tpDst != null && !this.tpDst.trim().isEmpty()) {
             match.setField(MatchType.TP_DST, Integer.valueOf(tpDst).shortValue());
         }
-
-        matches.add(match);
-        if(!ContainerFlowConfig.unidirectional) {
-            Match reverse = match.reverse();
-            if (!match.equals(reverse)) {
-                matches.add(reverse);
-            }
-        }
-        return matches;
+        return match;
     }
 
     /*
index e3d1e52..7ae309c 100644 (file)
@@ -51,7 +51,6 @@
 <unit id="org.eclipse.virgo.kernel.equinox.extensions" version="3.6.0.RELEASE"/>
 <unit id="org.eclipse.osgi.services" version="3.3.100.v20120522-1822"/>
 <unit id="org.eclipse.virgo.util.common" version="3.6.0.RELEASE"/>
-<unit id="com.sun.jersey.json" version="1.17.0"/>
 <unit id="org.eclipse.equinox.util" version="1.0.400.v20120522-2049"/>
 <unit id="org.springframework.core" version="3.1.3.RELEASE"/>
 <unit id="org.apache.commons.fileupload" version="1.2.2"/>
index b0f7ad8..6fca9db 100644 (file)
           <artifactId>forwardingrules-manager</artifactId>
           <version>${mdsal.version}</version>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller.md</groupId>
+          <artifactId>topology-lldp-discovery</artifactId>
+          <version>${mdsal.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller.md</groupId>
+          <artifactId>topology-manager</artifactId>
+          <version>${mdsal.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller.model</groupId>
+            <artifactId>model-topology</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+         <groupId>org.opendaylight.yangtools.model</groupId>
+         <artifactId>ietf-topology</artifactId>
+         <version>2013.07.12.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-util</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
         <dependency>
           <groupId>org.opendaylight.controller.md</groupId>
           <artifactId>statistics-manager</artifactId>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
     </dependency>
+
     <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-mapper-asl</artifactId>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-databind</artifactId>
     </dependency>
+
     <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-core-asl</artifactId>
+       <groupId>com.fasterxml.jackson.core</groupId>
+       <artifactId>jackson-annotations</artifactId>
     </dependency>
+
     <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-jaxrs</artifactId>
+       <groupId>com.fasterxml.jackson.core</groupId>
+       <artifactId>jackson-core</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-json-provider</artifactId>
+    </dependency>
+
+      <dependency>
+         <groupId>com.fasterxml.jackson.jaxrs</groupId>
+         <artifactId>jackson-jaxrs-base</artifactId>
+      </dependency>
+
     <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-xc</artifactId>
+      <groupId>com.fasterxml.jackson.module</groupId>
+      <artifactId>jackson-module-jaxb-annotations</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.codehaus.jettison</groupId>
       <artifactId>jettison</artifactId>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-client</artifactId>
     </dependency>
-    <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-json</artifactId>
-      <version>${jersey.version}</version>
-    </dependency>
+
     <dependency>
       <groupId>org.ow2.asm</groupId>
       <artifactId>asm-all</artifactId>
index 8fea175..6f8878b 100644 (file)
@@ -24,7 +24,6 @@
         <exclude>ch.qos.logback:logback-core</exclude>
         <exclude>ch.qos.logback:logback-classic</exclude>
         <exclude>com.sun.jersey:jersey-core</exclude>
-        <exclude>com.sun.jersey:jersey-json</exclude>
         <exclude>com.sun.jersey:jersey-server</exclude>
         <exclude>org.opendaylight.controller:logging.bridge</exclude>
         <exclude>org.opendaylight.controller:sanitytest</exclude>
@@ -52,7 +51,6 @@
         <include>ch.qos.logback:logback-core</include>
         <include>ch.qos.logback:logback-classic</include>
         <include>com.sun.jersey:jersey-core</include>
-        <include>com.sun.jersey:jersey-json</include>
         <include>com.sun.jersey:jersey-server</include>
         <include>org.opendaylight.controller:logging.bridge</include>
       </includes>
index ba5d862..995e407 100644 (file)
@@ -10,7 +10,6 @@ osgi.bundles=\
     reference\:file\:../lib/logback-core-1.0.9.jar@1:start,\
     reference\:file\:../lib/logging.bridge-0.4.1-SNAPSHOT@1:start,\
     reference\:file\:../lib/jersey-core-1.17.jar@2:start,\
-    reference\:file\:../lib/jersey-json-1.17.jar@2:start,\
     reference\:file\:../lib/jersey-server-1.17.jar@2:start
 
 # Netconf startup configuration
@@ -22,6 +21,8 @@ netconf.tcp.client.port=8383
 
 netconf.ssh.address=0.0.0.0
 netconf.ssh.port=1830
+netconf.ssh.pk.path = ./configuration/RSA.pk
+
 
 netconf.config.persister.active=1,2
 # read startup configuration
index 3a29f63..ffe53af 100755 (executable)
@@ -164,6 +164,8 @@ FWCLASSPATH=${FWCLASSPATH},file:${basedir}/lib/org.eclipse.virgo.kernel.equinox.
 CLASSPATH=${CLASSPATH}:${basedir}/lib/org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar
 FWCLASSPATH=${FWCLASSPATH},file:${basedir}/lib/org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar
 
+cd $basedir
+
 if [ "${stopdaemon}" -eq 1 ]; then
     if [ -e "${pidfile}" ]; then
         daemonpid=`cat "${pidfile}"`
index 83106a3..d9a0891 100644 (file)
@@ -122,7 +122,7 @@ public class FlowEntry implements Cloneable, Serializable {
         }
 
         if (flow == null) {
-            return (other.flow == null) ? true : false;
+            return other.flow == null;
         } else if (other.flow == null) {
             return false;
         }
index 3d6a029..2b3347f 100644 (file)
@@ -2639,6 +2639,13 @@ public class ForwardingRulesManager implements
         }
     }
 
+    /**
+     * Function called by the dependency manager before Container is Stopped and Destroyed.
+     */
+    public void containerStop() {
+        uninstallAllFlowEntries(false);
+    }
+
     /**
      * Function called by the dependency manager before the services exported by
      * the component are unregistered, this will be followed by a "destroy ()"
@@ -2646,7 +2653,6 @@ public class ForwardingRulesManager implements
      */
     void stop() {
         stopping = true;
-        uninstallAllFlowEntries(false);
         // Shutdown executor
         this.executor.shutdownNow();
         // Now walk all the workMonitor and wake up the one sleeping because
index d7c60e6..e222fcd 100644 (file)
@@ -25,7 +25,6 @@ public class HostTrackerTest extends TestCase {
 \r
         HostTracker hostTracker = null;\r
         hostTracker = new HostTracker();\r
-        Assert.assertFalse(hostTracker == null);\r
 \r
         InetAddress hostIP = InetAddress.getByName("192.168.0.8");\r
         IHostId id  = IPHostId.fromIP(hostIP);\r
@@ -44,7 +43,6 @@ public class HostTrackerTest extends TestCase {
     public void testHostTracker() throws UnknownHostException {\r
         HostTracker hostTracker = null;\r
         hostTracker = new HostTracker();\r
-        Assert.assertFalse(hostTracker == null);\r
 \r
         InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8");\r
         IHostId id1 = IPHostId.fromIP(hostIP_1);\r
index 430b595..62e767b 100644 (file)
@@ -225,7 +225,7 @@ class CompatibleSwitchManager extends ConfigurableSwitchManager implements ISwit
         val ret = new HashSet<NodeConnector>();
         for (nc : data.nodeConnector) {
             val flowConn = nc.getAugmentation(FlowCapableNodeConnector);
-            if (flowConn != null && flowConn.state == PortState.Live) {
+            if (flowConn != null && flowConn.state != null && !flowConn.state.linkDown) {
                 ret.add(new NodeConnector(MD_SAL_TYPE, nc.key, node));
             }
         }
index 15a9a68..f72e5b9 100644 (file)
       <artifactId>model-flow-statistics</artifactId>
       <version>1.0-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller.model</groupId>
+      <artifactId>model-topology</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-binding-util</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
   </dependencies>
   <packaging>bundle</packaging>
 
index b460edf..d7a345c 100644 (file)
@@ -1,35 +1,41 @@
 package org.opendaylight.controller.sal.compatibility
 
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
-import org.opendaylight.controller.sal.core.Node
-import org.opendaylight.controller.sal.core.NodeConnector
-import static org.opendaylight.controller.sal.compatibility.NodeMapping.*
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey
-import org.apache.felix.dm.Component
 import java.util.Arrays
-import org.opendaylight.yangtools.yang.binding.NotificationListener
 import java.util.Dictionary
 import java.util.Hashtable
-import org.opendaylight.controller.sal.utils.GlobalConstants
+import org.apache.felix.dm.Component
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker
-import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService
-import org.opendaylight.controller.sal.inventory.IPluginInInventoryService
-import org.opendaylight.controller.sal.reader.IPluginInReadService
-import org.opendaylight.controller.sal.flowprogrammer.IPluginOutFlowProgrammerService
-import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer
 import org.opendaylight.controller.sal.binding.api.NotificationService
 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.sal.compatibility.topology.TopologyAdapter
+import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase
+import org.opendaylight.controller.sal.core.Node
+import org.opendaylight.controller.sal.core.NodeConnector
+import org.opendaylight.controller.sal.discovery.IDiscoveryService
+import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService
+import org.opendaylight.controller.sal.flowprogrammer.IPluginOutFlowProgrammerService
+import org.opendaylight.controller.sal.inventory.IPluginInInventoryService
+import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService
 import org.opendaylight.controller.sal.packet.IPluginOutDataPacketService
-import org.osgi.framework.BundleContext
+import org.opendaylight.controller.sal.reader.IPluginInReadService
 import org.opendaylight.controller.sal.reader.IPluginOutReadService
-import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService
-import org.opendaylight.controller.sal.discovery.IDiscoveryService
+import org.opendaylight.controller.sal.topology.IPluginInTopologyService
 import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
+import org.opendaylight.controller.sal.utils.GlobalConstants
+import org.opendaylight.controller.sal.utils.INodeConnectorFactory
+import org.opendaylight.controller.sal.utils.INodeFactory
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService
+import org.osgi.framework.BundleContext
+
+import static org.opendaylight.controller.sal.compatibility.NodeMapping.*
+import org.opendaylight.controller.sal.compatibility.topology.TopologyProvider
 
 class ComponentActivator extends ComponentActivatorAbstractBase implements BindingAwareConsumer {
 
@@ -44,9 +50,22 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
     @Property
     DataPacketAdapter dataPacket = new DataPacketAdapter;
 
+    @Property
+    INodeFactory nodeFactory = new MDSalNodeFactory
+
+    @Property
+    INodeConnectorFactory nodeConnectorFactory = new MDSalNodeConnectorFactory
+    
+    @Property
+    TopologyAdapter topology = new TopologyAdapter
+    
+    @Property
+    TopologyProvider tpProvider = new TopologyProvider()
+
+
     override protected init() {
-        Node.NodeIDType.registerIDType(MD_SAL_TYPE, NodeKey);
-        NodeConnector.NodeConnectorIDType.registerIDType(MD_SAL_TYPE, NodeConnectorKey, MD_SAL_TYPE);
+        Node.NodeIDType.registerIDType(MD_SAL_TYPE, String);
+        NodeConnector.NodeConnectorIDType.registerIDType(MD_SAL_TYPE, String, MD_SAL_TYPE);
     }
 
     override start(BundleContext context) {
@@ -63,6 +82,7 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
 
         // Registration of Flow Service
         flow.delegate = session.getRpcService(SalFlowService)
+        flow.dataBrokerService = session.getSALService(DataBrokerService);
         subscribe.registerNotificationListener(flow);
 
         // Data Packet Service
@@ -71,25 +91,41 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
         // Inventory Service
         inventory.dataService = session.getSALService(DataBrokerService);
         inventory.flowStatisticsService = session.getRpcService(OpendaylightFlowStatisticsService);
+        inventory.flowTableStatisticsService = session.getRpcService(OpendaylightFlowTableStatisticsService);
+        inventory.nodeConnectorStatisticsService = session.getRpcService(OpendaylightPortStatisticsService);
         inventory.topologyDiscovery = session.getRpcService(FlowTopologyDiscoveryService);
+               inventory.dataProviderService = session.getSALService(DataProviderService)
+               topology.dataService = session.getSALService(DataProviderService)
+               tpProvider.dataService = session.getSALService(DataProviderService)
+               tpProvider.start();
 
         subscribe.registerNotificationListener(dataPacket)
 
     }
 
     override protected getGlobalImplementations() {
-        return Arrays.asList(this, flow, inventory, dataPacket)
+        return Arrays.asList(this, flow, inventory, dataPacket, nodeFactory, nodeConnectorFactory,topology,tpProvider)
     }
 
     override protected configureGlobalInstance(Component c, Object imp) {
         configure(imp, c);
     }
 
+    private def dispatch configure(MDSalNodeFactory imp, Component it) {
+        setInterface(INodeFactory.name, properties);
+    }
+
+    private def dispatch configure(MDSalNodeConnectorFactory imp, Component it) {
+        setInterface(INodeConnectorFactory.name, properties);
+    }
+
     private def dispatch configure(ComponentActivator imp, Component it) {
         add(
             createServiceDependency().setService(BindingAwareBroker) //
             .setCallbacks("setBroker", "setBroker") //
             .setRequired(true))
+
+
     }
 
     private def dispatch configure(DataPacketAdapter imp, Component it) {
@@ -114,29 +150,42 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
         add(
             createServiceDependency() //
             .setService(IPluginOutReadService) //
-            .setCallbacks("setReadPublisher", "setReadPublisher") //
+            .setCallbacks("setReadPublisher", "unsetReadPublisher") //
             .setRequired(false))
         add(
             createServiceDependency() //
             .setService(IPluginOutInventoryService) //
             .setCallbacks("setInventoryPublisher", "setInventoryPublisher") //
             .setRequired(false))
+        add(
+            createServiceDependency() //
+            .setService(IDiscoveryService) //
+            .setCallbacks("setDiscoveryPublisher", "setDiscoveryPublisher") //
+            .setRequired(false))
+        
+    }
+    
+    private def dispatch configure (TopologyAdapter imp, Component it) {
+        setInterface(Arrays.asList(IPluginInTopologyService.name), properties)
         add(
             createServiceDependency() //
             .setService(IPluginOutTopologyService) //
             .setCallbacks("setTopologyPublisher", "setTopologyPublisher") //
             .setRequired(false))
+    }
+    
+    private def dispatch configure (TopologyProvider imp, Component it) {
         add(
             createServiceDependency() //
-            .setService(IDiscoveryService) //
-            .setCallbacks("setDiscoveryPublisher", "setDiscoveryPublisher") //
+            .setService(IPluginOutTopologyService) //
+            .setCallbacks("setTopologyPublisher", "setTopologyPublisher") //
             .setRequired(false))
-        
     }
 
     private def Dictionary<String, Object> properties() {
         val props = new Hashtable<String, Object>();
         props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString, MD_SAL_TYPE)
+        props.put("protocolName", MD_SAL_TYPE);
         return props;
     }
 }
index ce6af64..f1c19b1 100644 (file)
@@ -15,8 +15,9 @@ class DataPacketAdapter implements PacketProcessingListener {
         dataPacketPublisher.receiveDataPacket(inPacket);
     }
 
-    public static def RawPacket toRawPacket(PacketReceived received) {
+    public static def RawPacket toRawPacket(PacketReceived received) {        
         val ret = new RawPacket(received.payload);
+        ret.setIncomingNodeConnector(NodeMapping.toADNodeConnector(received.ingress))
         return ret;
     }
 
index 2eae511..450c7f1 100644 (file)
@@ -18,7 +18,24 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.Node
 import org.opendaylight.yangtools.yang.common.RpcResult
 import org.slf4j.LoggerFactory
 
-import static org.opendaylight.controller.sal.compatibility.MDFlowMapping.*
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+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.TableKey
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey
+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.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId
+
+
+import static extension org.opendaylight.controller.sal.compatibility.MDFlowMapping.*
 
 import static extension org.opendaylight.controller.sal.compatibility.NodeMapping.*
 import static extension org.opendaylight.controller.sal.compatibility.ToSalConversionsUtils.*
@@ -29,64 +46,52 @@ class FlowProgrammerAdapter implements IPluginInFlowProgrammerService, SalFlowLi
 
     @Property
     private SalFlowService delegate;
+
+    @Property
+    private DataBrokerService dataBrokerService;
     
     @Property
     private IPluginOutFlowProgrammerService flowProgrammerPublisher;
 
     override addFlow(Node node, Flow flow) {
-        val input = addFlowInput(node, flow);
-        val future = delegate.addFlow(input);
-        try {
-            val result = future.get();
-            return toStatus(result); // how get status from result? conversion?
-        } catch (Exception e) {
-            return processException(e);
-        }
+        return addFlowAsync(node,flow,0)
     }
 
     override modifyFlow(Node node, Flow oldFlow, Flow newFlow) {
-        val input = updateFlowInput(node, oldFlow, newFlow);
-        val future = delegate.updateFlow(input);
-        try {
-            val result = future.get();
-            return toStatus(result);
-        } catch (Exception e) {
-            return processException(e);
-        }
+        return modifyFlowAsync(node, oldFlow,newFlow,0)
     }
 
     override removeFlow(Node node, Flow flow) {
-        val input = removeFlowInput(node, flow);
-        val future = delegate.removeFlow(input);
-
-        try {
-            val result = future.get();
-            return toStatus(result);
-        } catch (Exception e) {
-            return processException(e);
-        }
+        return removeFlowAsync(node, flow,0);
     }
 
     override addFlowAsync(Node node, Flow flow, long rid) {
-        val input = addFlowInput(node, flow);
-        delegate.addFlow(input);
-        return new Status(StatusCode.SUCCESS);
+        writeFlow(flow.toMDFlow, new NodeKey(new NodeId(node.getNodeIDString())));
+        return toStatus(true);
     }
 
     override modifyFlowAsync(Node node, Flow oldFlow, Flow newFlow, long rid) {
-        val input = updateFlowInput(node, oldFlow, newFlow);
-        delegate.updateFlow(input);
-        return new Status(StatusCode.SUCCESS);
+        writeFlow(newFlow.toMDFlow, new NodeKey(new NodeId(node.getNodeIDString())));
+        return toStatus(true);
     }
 
-    override removeFlowAsync(Node node, Flow flow, long rid) {
-        val input = removeFlowInput(node, flow);
-        delegate.removeFlow(input);
-        return new Status(StatusCode.SUCCESS);
+    override removeFlowAsync(Node node, Flow adflow, long rid) {
+        val flow = adflow.toMDFlow;
+        val modification = this._dataBrokerService.beginTransaction();
+        val flowPath = InstanceIdentifier.builder(Nodes)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, new NodeKey(new NodeId(node.getNodeIDString())))
+                .augmentation(FlowCapableNode)
+                .child(Table, new TableKey(flow.getTableId()))
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow, new FlowKey(flow.id))
+                .build;
+        modification.removeConfigurationData(flowPath);
+        val commitFuture = modification.commit();
+        return toStatus(true);
     }
 
     override removeAllFlows(Node node) {
-        throw new UnsupportedOperationException("Not present in MD-SAL");
+        // I know this looks like a copout... but its exactly what the legacy OFplugin did
+        return new Status(StatusCode.SUCCESS);
     }
 
     override syncSendBarrierMessage(Node node) {
@@ -101,13 +106,38 @@ class FlowProgrammerAdapter implements IPluginInFlowProgrammerService, SalFlowLi
         return null;
     }
 
-    public static def toStatus(RpcResult<?> result) {
-        if (result.isSuccessful()) {
+    private static def toStatus(boolean successful) {
+        if (successful) {
             return new Status(StatusCode.SUCCESS);
         } else {
             return new Status(StatusCode.INTERNALERROR);
         }
     }
+
+
+    private def writeFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow flow, NodeKey nodeKey) {
+        val modification = this._dataBrokerService.beginTransaction();
+        val flowPath = InstanceIdentifier.builder(Nodes)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, nodeKey)
+                .augmentation(FlowCapableNode)
+                .child(Table, new TableKey(flow.getTableId()))
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow, new FlowKey(flow.id))
+                .build;
+        modification.putConfigurationData(flowPath, flow);
+        val commitFuture = modification.commit();
+        try {
+            val result = commitFuture.get();
+            val status = result.getResult();
+        } catch (InterruptedException e) {
+            LOG.error(e.getMessage(), e);
+        } catch (ExecutionException e) {
+            LOG.error(e.getMessage(), e);
+        }
+    }
+
+    public static def toStatus(RpcResult<?> result) {
+        return toStatus(result.isSuccessful());
+    }
     
     private static dispatch def Status processException(InterruptedException e) {
         LOG.error("Interruption occured during processing flow",e);
index ad6009c..eba4aa9 100644 (file)
@@ -1,5 +1,9 @@
 package org.opendaylight.controller.sal.compatibility;
 
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
 import static org.opendaylight.controller.sal.match.MatchType.DL_DST;
 import static org.opendaylight.controller.sal.match.MatchType.DL_SRC;
 import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE;
@@ -8,11 +12,7 @@ import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
 
-
 import org.opendaylight.controller.sal.core.NodeConnector;
-
-
-
 import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchField;
 import org.opendaylight.controller.sal.match.MatchType;
@@ -22,14 +22,12 @@ 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.inet.types.rev100924.Ipv6Prefix;
 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.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInputBuilder;
 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;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
@@ -53,9 +51,8 @@ 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 com.google.common.net.InetAddresses;
-import static org.opendaylight.controller.sal.compatibility.NodeMapping.*;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.*;
 
 public class FromSalConversionsUtils {
 
@@ -63,19 +60,7 @@ public class FromSalConversionsUtils {
 
     }
 
-    public static GetNodeConnectorStatisticsInput nodeConnectorStatistics(
-            NodeConnector connector) {
-        GetNodeConnectorStatisticsInputBuilder target = new GetNodeConnectorStatisticsInputBuilder();
-
-        NodeRef nodeRef = toNodeRef(connector.getNode());
-        target.setNode(nodeRef);
-
-        NodeConnectorRef nodeConnectorRef = toNodeConnectorRef(connector);
-        target.setNodeConnector(nodeConnectorRef);
-
-        return target.build();
-    }
-
+    @SuppressWarnings("unused")
     private static Address addressFromAction(InetAddress inetAddress) {
         String strInetAddresss = InetAddresses.toAddrString(inetAddress);
         if (inetAddress instanceof Inet4Address) {
@@ -100,6 +85,7 @@ public class FromSalConversionsUtils {
             targetBuilder.setVlanMatch(vlanMatch(sourceMatch));
             targetBuilder.setLayer3Match(layer3Match(sourceMatch));
             targetBuilder.setLayer4Match(layer4Match(sourceMatch));
+            targetBuilder.setInPort(inPortMatch(sourceMatch));
 
             return targetBuilder.build();
         }
@@ -107,6 +93,14 @@ public class FromSalConversionsUtils {
 
     }
 
+    private static NodeConnectorId inPortMatch(Match sourceMatch) {
+        MatchField inPort = sourceMatch.getField(MatchType.IN_PORT);
+        if(inPort != null && inPort.getValue() != null && (inPort.getValue() instanceof NodeConnector)) {
+            return new NodeConnectorId(((NodeConnector) inPort.getValue()).getNodeConnectorIdAsString());
+        }
+        return null;
+    }
+
     private static Layer4Match layer4Match(final Match sourceMatch) {
         MatchField nwProto = sourceMatch.getField(MatchType.NW_PROTO);
         Short nwProtocolSource = null;
@@ -138,8 +132,10 @@ public class FromSalConversionsUtils {
             sctpMatchBuilder.setSctpDestinationPort(new PortNumber(
                     destinationPort));
         }
-
-        return sctpMatchBuilder.build();
+        if(sourcePort != null || destinationPort != null) {
+            return sctpMatchBuilder.build();
+        }
+        return null;
     }
 
     private static Layer4Match Layer4MatchAsUdp(final Match sourceMatch) {
@@ -157,8 +153,10 @@ public class FromSalConversionsUtils {
             udpMatchBuilder.setUdpDestinationPort(new PortNumber(
                     destinationPort));
         }
-
-        return udpMatchBuilder.build();
+        if(sourcePort != null || destinationPort != null) {
+            return udpMatchBuilder.build();
+        }
+        return null;
     }
 
     private static Layer4Match Layer4MatchAsTcp(final Match sourceMatch) {
@@ -175,8 +173,10 @@ public class FromSalConversionsUtils {
             tcpMatchBuilder.setTcpDestinationPort(new PortNumber(
                     destinationPort));
         }
-
-        return tcpMatchBuilder.build();
+        if(sourcePort != null || destinationPort != null) {
+            return tcpMatchBuilder.build();
+        }
+        return null;
     }
 
     private static Integer transportPort(final Match sourceMatch,
@@ -196,7 +196,7 @@ public class FromSalConversionsUtils {
         MatchField vlan = sourceMatch.getField(MatchType.DL_VLAN);
         if (vlan != null && vlan.getValue() != null) {
             VlanIdBuilder vlanIDBuilder = new VlanIdBuilder();
-            vlanIDBuilder.setVlanId(new VlanId((int) (NetUtils
+            vlanIDBuilder.setVlanId(new VlanId((NetUtils
                     .getUnsignedShort((short) vlan.getValue()))));
             vlanMatchBuild.setVlanId(vlanIDBuilder.build());
         }
@@ -206,8 +206,10 @@ public class FromSalConversionsUtils {
             vlanMatchBuild.setVlanPcp(new VlanPcp((short) ((byte) vlanPriority
                     .getValue())));
         }
-
-        return vlanMatchBuild.build();
+        if((vlan != null && vlan.getValue() != null) || (vlanPriority != null && vlanPriority.getValue() != null)) {
+            return vlanMatchBuild.build();
+        }
+        return null;
     }
 
     private static IpMatch ipMatch(final Match sourceMatch) {
@@ -225,21 +227,24 @@ public class FromSalConversionsUtils {
             targetIpMatchBuild.setIpProtocol((short) ((byte) protocol
                     .getValue()));
         }
-
-        return targetIpMatchBuild.build();
-
+        if((networkTos != null && networkTos.getValue() != null) || (protocol != null && protocol.getValue() != null)) {
+            return targetIpMatchBuild.build();
+        }
+        return null;
     }
 
     private static EthernetMatch ethernetMatch(final Match sourceMatch) {
         final EthernetMatchBuilder targetEthMatchBuild = new EthernetMatchBuilder();
-
-        EthernetSourceBuilder ethSourBuild = new EthernetSourceBuilder()
-                .setAddress(ethernetSourceAddress(sourceMatch));
-        targetEthMatchBuild.setEthernetSource(ethSourBuild.build());
-
-        EthernetDestinationBuilder ethDestBuild = new EthernetDestinationBuilder()
-                .setAddress(ethernetDestAddress(sourceMatch));
-        targetEthMatchBuild.setEthernetDestination(ethDestBuild.build());
+        if(sourceMatch.getField(DL_SRC) != null && sourceMatch.getField(DL_SRC).getValue() != null) {
+            EthernetSourceBuilder ethSourBuild = new EthernetSourceBuilder()
+                    .setAddress(ethernetSourceAddress(sourceMatch));
+            targetEthMatchBuild.setEthernetSource(ethSourBuild.build());
+        }
+        if(sourceMatch.getField(DL_DST) != null && sourceMatch.getField(DL_DST).getValue() != null) {
+            EthernetDestinationBuilder ethDestBuild = new EthernetDestinationBuilder()
+                    .setAddress(ethernetDestAddress(sourceMatch));
+            targetEthMatchBuild.setEthernetDestination(ethDestBuild.build());
+        }
 
         final MatchField dataLinkType = sourceMatch.getField(MatchType.DL_TYPE);
         if (dataLinkType != null && dataLinkType.getValue() != null) {
@@ -249,7 +254,12 @@ public class FromSalConversionsUtils {
                     .setType(etherType);
             targetEthMatchBuild.setEthernetType(ethType.build());
         }
-        return targetEthMatchBuild.build();
+        if((sourceMatch.getField(DL_SRC) != null && sourceMatch.getField(DL_SRC).getValue() != null) || 
+                (sourceMatch.getField(DL_DST) != null && sourceMatch.getField(DL_DST).getValue() != null)|| 
+                dataLinkType != null ) {
+            return targetEthMatchBuild.build();            
+        } 
+        return null;
     }
 
     private static MacAddress ethernetSourceAddress(final Match sourceMatch) {
@@ -270,12 +280,12 @@ public class FromSalConversionsUtils {
 
         InetAddress inetDestAddress = null;
         MatchField netDest = sourceMatch.getField(MatchType.NW_DST);
-        if (netSource != null && netSource.getValue() != null) {
+        if (netDest != null && netDest.getValue() != null) {
             inetDestAddress = (InetAddress) (netDest.getValue());
         }
 
         if ((inetSourceAddress instanceof Inet4Address)
-                && (inetDestAddress instanceof Inet4Address)) {
+                || (inetDestAddress instanceof Inet4Address)) {
             MatchField dataLinkType = sourceMatch.getField(DL_TYPE);
             Short dLType = null;
             if (dataLinkType != null && dataLinkType.getValue() != null) {
@@ -290,7 +300,7 @@ public class FromSalConversionsUtils {
                         (Inet4Address) inetDestAddress);
             }
         } else if ((inetSourceAddress instanceof Inet6Address)
-                && (inetDestAddress instanceof Inet6Address)) {
+                || (inetDestAddress instanceof Inet6Address)) {
             return setLayer3MatchAsIpv6((Inet6Address) inetSourceAddress,
                     (Inet6Address) inetDestAddress);
         }
@@ -344,15 +354,18 @@ public class FromSalConversionsUtils {
     private static Layer3Match setLayer3MatchAsIpv4(
             final Inet4Address inetSourceAddress,
             final Inet4Address inetDestAddress) {
-        String inetSrcAddressString = InetAddresses
-                .toAddrString(inetSourceAddress);
-        String inetDstAddressString = InetAddresses
-                .toAddrString(inetDestAddress);
-
         Ipv4MatchBuilder layer4MatchBuild = new Ipv4MatchBuilder();
-        layer4MatchBuild.setIpv4Source(new Ipv4Prefix(inetSrcAddressString));
-        layer4MatchBuild
-                .setIpv4Destination(new Ipv4Prefix(inetDstAddressString));
+        if(inetSourceAddress != null) {
+            String inetSrcAddressString = InetAddresses
+                    .toAddrString(inetSourceAddress);
+            layer4MatchBuild.setIpv4Source(new Ipv4Prefix(inetSrcAddressString));
+        }
+        if(inetDestAddress != null) {
+            String inetDstAddressString = InetAddresses
+                    .toAddrString(inetDestAddress);
+            layer4MatchBuild
+            .setIpv4Destination(new Ipv4Prefix(inetDstAddressString));
+        }       
         return layer4MatchBuild.build();
 
     }
@@ -360,16 +373,90 @@ public class FromSalConversionsUtils {
     private static Layer3Match setLayer3MatchAsIpv6(
             final Inet6Address inetSourceAddress,
             final Inet6Address inetDestAddress) {
-        String inetSrcAddressString = InetAddresses
-                .toAddrString(inetSourceAddress);
-        String inetDstAddressString = InetAddresses
-                .toAddrString(inetDestAddress);
         Ipv6MatchBuilder layer6MatchBuild = new Ipv6MatchBuilder();
-
-        layer6MatchBuild.setIpv6Source(new Ipv6Prefix(inetSrcAddressString));
-        layer6MatchBuild
-                .setIpv6Destination(new Ipv6Prefix(inetDstAddressString));
+        if(inetSourceAddress != null) {
+            String inetSrcAddressString = InetAddresses
+                    .toAddrString(inetSourceAddress);
+            layer6MatchBuild.setIpv6Source(new Ipv6Prefix(inetSrcAddressString));
+        }
+        if(inetDestAddress != null) {
+            String inetDstAddressString = InetAddresses
+                    .toAddrString(inetDestAddress);    
+            layer6MatchBuild
+                    .setIpv6Destination(new Ipv6Prefix(inetDstAddressString));
+        }
         return layer6MatchBuild.build();
     }
+    
+    public static boolean flowEquals(Flow statsFlow, Flow storedFlow) {
+        if (statsFlow.getClass() != storedFlow.getClass()) {
+            return false;
+        }
+        if (statsFlow.getBufferId()== null) {
+            if (storedFlow.getBufferId() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getBufferId().equals(storedFlow.getBufferId())) {
+            return false;
+        }
+        if (statsFlow.getContainerName()== null) {
+            if (storedFlow.getContainerName()!= null) {
+                return false;
+            }
+        } else if(!statsFlow.getContainerName().equals(storedFlow.getContainerName())) {
+            return false;
+        }
+        if (statsFlow.getCookie()== null) {
+            if (storedFlow.getCookie()!= null) {
+                return false;
+            }
+        } else if(!statsFlow.getCookie().equals(storedFlow.getCookie())) {
+            return false;
+        }
+        if (statsFlow.getMatch()== null) {
+            if (storedFlow.getMatch() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getMatch().equals(storedFlow.getMatch())) {
+            return false;
+        }
+        if (statsFlow.getCookie()== null) {
+            if (storedFlow.getCookie()!= null) {
+                return false;
+            }
+        } else if(!statsFlow.getCookie().equals(storedFlow.getCookie())) {
+            return false;
+        }
+        if (statsFlow.getHardTimeout() == null) {
+            if (storedFlow.getHardTimeout() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getHardTimeout().equals(storedFlow.getHardTimeout() )) {
+            return false;
+        }
+        if (statsFlow.getIdleTimeout()== null) {
+            if (storedFlow.getIdleTimeout() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getIdleTimeout().equals(storedFlow.getIdleTimeout())) {
+            return false;
+        }
+        if (statsFlow.getPriority() == null) {
+            if (storedFlow.getPriority() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getPriority().equals(storedFlow.getPriority())) {
+            return false;
+        }
+        if (statsFlow.getTableId() == null) {
+            if (storedFlow.getTableId() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getTableId().equals(storedFlow.getTableId())) {
+            return false;
+        }
+        return true;
+    }
+
 
 }
index 8ac6f1b..56ca1b6 100644 (file)
 package org.opendaylight.controller.sal.compatibility
 
-import org.opendaylight.controller.sal.reader.IPluginInReadService
-import org.opendaylight.controller.sal.core.NodeConnector
+import java.util.ArrayList
+import java.util.Collections
+import java.util.List
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.sal.core.Edge
 import org.opendaylight.controller.sal.core.Node
-import org.opendaylight.controller.sal.flowprogrammer.Flow
 import org.opendaylight.controller.sal.core.NodeTable
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
-
-import static extension org.opendaylight.controller.sal.common.util.Arguments.*
-import static extension org.opendaylight.controller.sal.compatibility.NodeMapping.*
-import static org.opendaylight.controller.sal.compatibility.MDFlowMapping.*
+import org.opendaylight.controller.sal.core.UpdateType
+import org.opendaylight.controller.sal.flowprogrammer.Flow
+import org.opendaylight.controller.sal.inventory.IPluginInInventoryService
+import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService
+import org.opendaylight.controller.sal.reader.FlowOnNode
+import org.opendaylight.controller.sal.reader.IPluginInReadService
+import org.opendaylight.controller.sal.reader.IPluginOutReadService
+import org.opendaylight.controller.sal.reader.NodeConnectorStatistics
+import org.opendaylight.controller.sal.reader.NodeDescription
+import org.opendaylight.controller.sal.reader.NodeTableStatistics
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef
+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.statistics.rev130819.AggregateFlowStatisticsUpdate
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService
-import org.opendaylight.controller.sal.reader.NodeConnectorStatistics
-import org.opendaylight.controller.sal.reader.FlowOnNode
-import org.opendaylight.controller.sal.reader.NodeDescription
-import org.slf4j.LoggerFactory
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsInputBuilder
-import java.util.ArrayList
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsInputBuilder
-import org.opendaylight.controller.sal.inventory.IPluginInInventoryService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener
-import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.Link
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated
-import java.util.Collections
-import org.opendaylight.controller.sal.core.UpdateType
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatistics
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsListener
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService
 import org.opendaylight.yangtools.yang.binding.DataObject
-import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
-import org.opendaylight.controller.sal.topology.IPluginInTopologyService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener
-import org.opendaylight.controller.sal.core.Edge
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.Link
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal
-import org.opendaylight.controller.sal.topology.TopoEdgeUpdate
-import org.opendaylight.controller.sal.discovery.IDiscoveryService
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.slf4j.LoggerFactory
 
-class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInReadService, IPluginInInventoryService, OpendaylightInventoryListener, FlowTopologyDiscoveryListener {
+import static extension org.opendaylight.controller.sal.common.util.Arguments.*
+import static extension org.opendaylight.controller.sal.compatibility.NodeMapping.*
+import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
+import java.util.concurrent.ConcurrentHashMap
+import java.util.Map
+
+class InventoryAndReadAdapter implements IPluginInReadService,
+                                                                                        IPluginInInventoryService,
+                                                                                        OpendaylightInventoryListener,
+                                                                                        OpendaylightFlowStatisticsListener,
+                                                                                        OpendaylightFlowTableStatisticsListener,
+                                                                                        OpendaylightPortStatisticsListener {
 
     private static val LOG = LoggerFactory.getLogger(InventoryAndReadAdapter);
 
+       private static val OPENFLOWV10_TABLE_ID = new Integer(0).shortValue;
     @Property
     DataBrokerService dataService;
 
     @Property
-    OpendaylightFlowStatisticsService flowStatisticsService;
+    DataProviderService dataProviderService;
 
     @Property
-    IPluginOutInventoryService inventoryPublisher;
+    OpendaylightFlowStatisticsService flowStatisticsService;
 
     @Property
-    IPluginOutTopologyService topologyPublisher;
+    OpendaylightPortStatisticsService nodeConnectorStatisticsService;
     
     @Property
-    IDiscoveryService discoveryPublisher;
+    OpendaylightFlowTableStatisticsService flowTableStatisticsService;
+
+    @Property
+    IPluginOutInventoryService inventoryPublisher;
 
     @Property
     FlowTopologyDiscoveryService topologyDiscovery;
+    
+    @Property
+    List<IPluginOutReadService> statisticsPublisher = new ArrayList<IPluginOutReadService>();
+       
+    def setReadPublisher(IPluginOutReadService listener) {
+       statisticsPublisher.add(listener);
+    }
+    
+    def unsetReadPublisher (IPluginOutReadService listener) {
+       if( listener != null)
+               statisticsPublisher.remove(listener);
+    }
+
+    protected def startChange() {
+        return dataProviderService.beginTransaction;
+    }
 
-    override getTransmitRate(NodeConnector connector) {
+    override getTransmitRate(org.opendaylight.controller.sal.core.NodeConnector connector) {
         val nodeConnector = readFlowCapableNodeConnector(connector.toNodeConnectorRef);
         return nodeConnector.currentSpeed
     }
 
     override readAllFlow(Node node, boolean cached) {
-        val input = new GetAllFlowStatisticsInputBuilder;
-        input.setNode(node.toNodeRef);
-        val result = flowStatisticsService.getAllFlowStatistics(input.build)
 
-        val statistics = result.get.result;
         val output = new ArrayList<FlowOnNode>();
-        for (stat : statistics.flowStatistics) {
-            // FIXME: Create FlowOnNode
-        }
+               val tableRef = InstanceIdentifier.builder(Nodes)
+                                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
+                                                       .augmentation(FlowCapableNode).child(Table, new TableKey(OPENFLOWV10_TABLE_ID)).toInstance();
+               
+               val it = this.startChange();
+               
+               val table= it.readConfigurationData(tableRef) as Table;
+               
+               if(table != null){
+                       LOG.info("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
+                       
+                       for(flow : table.flow){
+                               
+                               val adsalFlow = ToSalConversionsUtils.toFlow(flow);
+                               val statsFromDataStore = flow.getAugmentation(FlowStatisticsData) as FlowStatisticsData;
+                               
+                               if(statsFromDataStore != null){
+                                       val it = new FlowOnNode(adsalFlow);
+                                       byteCount =  statsFromDataStore.flowStatistics.byteCount.value.longValue;
+                                       packetCount = statsFromDataStore.flowStatistics.packetCount.value.longValue;
+                                       durationSeconds = statsFromDataStore.flowStatistics.duration.second.value.intValue;
+                                       durationNanoseconds = statsFromDataStore.flowStatistics.duration.nanosecond.value.intValue;
+                                       
+                                       output.add(it);
+                               }
+                       }
+               }
+        
+        //TODO (main): Shell we send request to the switch? It will make async request to the switch.
+        // Once plugin receive response, it will let adaptor know through onFlowStatisticsUpdate()
+        // If we assume that md-sal statistics manager will always be running, then its not required
+        // But if not, then sending request will collect the latest data for adaptor atleast.
+        val input = new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
+        input.setNode(node.toNodeRef);
+        flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input.build)
+        
         return output;
     }
 
     override readAllNodeConnector(Node node, boolean cached) {
-        val input = new GetAllNodeConnectorStatisticsInputBuilder();
+       
+       val ret = new ArrayList<NodeConnectorStatistics>();
+               val nodeRef = InstanceIdentifier.builder(Nodes)
+                                                                       .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
+                                                                       .toInstance();
+               
+               val provider = this.startChange();
+               
+               val dsNode= provider.readConfigurationData(nodeRef) as org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+               
+               if(dsNode != null){
+                       
+                       for (dsNodeConnector : dsNode.nodeConnector){
+                               val nodeConnectorRef = InstanceIdentifier.builder(Nodes)
+                                                                       .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
+                                                                       .child(NodeConnector, dsNodeConnector.key)
+                                                                       .toInstance();
+                               
+                               val nodeConnectorFromDS = provider.readConfigurationData(nodeConnectorRef) as NodeConnector;
+                               
+                               if(nodeConnectorFromDS != null){
+                                       val nodeConnectorStatsFromDs = nodeConnectorFromDS.getAugmentation(FlowCapableNodeConnectorStatisticsData) as FlowCapableNodeConnectorStatistics;
+                                       
+                                       ret.add(toNodeConnectorStatistics(nodeConnectorStatsFromDs.flowCapableNodeConnectorStatistics,dsNode.id,dsNodeConnector.id));
+                               }
+                       }
+               }
+
+               //TODO: Refer TODO (main)
+        val input = new GetAllNodeConnectorsStatisticsInputBuilder();
         input.setNode(node.toNodeRef);
-        val result = flowStatisticsService.getAllNodeConnectorStatistics(input.build());
-        val statistics = result.get.result.nodeConnectorStatistics;
-        val ret = new ArrayList<NodeConnectorStatistics>();
-        for (stat : statistics) {
-            ret.add(stat.toNodeConnectorStatistics())
-        }
+        nodeConnectorStatisticsService.getAllNodeConnectorsStatistics(input.build());
         return ret;
     }
 
     override readAllNodeTable(Node node, boolean cached) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+       val ret = new ArrayList<NodeTableStatistics>();
+       
+               val dsFlowCapableNode= readFlowCapableNode(node.toNodeRef)
+               
+               if(dsFlowCapableNode != null){
+                       
+                       for (table : dsFlowCapableNode.table){
+                               
+                               val tableStats = table.getAugmentation(FlowTableStatisticsData) as FlowTableStatisticsData;
+                               
+                               if(tableStats != null){
+                                       ret.add(toNodeTableStatistics(tableStats.flowTableStatistics,table.id,node));
+                               }
+                       }
+               }
+
+               //TODO: Refer TODO (main)
+        val input = new GetFlowTablesStatisticsInputBuilder();
+        input.setNode(node.toNodeRef);
+        flowTableStatisticsService.getFlowTablesStatistics(input.build);
+        return ret;
     }
 
     override readDescription(Node node, boolean cached) {
-        val capableNode = readFlowCapableNode(node.toNodeRef)
-
-        val it = new NodeDescription()
-        manufacturer = capableNode.manufacturer
-        serialNumber = capableNode.serialNumber
-        software = capableNode.software
-        description = capableNode.description
-
-        return it;
+        return toNodeDescription(node.toNodeRef);
+       }
+
+    override readFlow(Node node, Flow targetFlow, boolean cached) {
+               var FlowOnNode ret= null;
+               
+               val tableRef = InstanceIdentifier.builder(Nodes)
+                                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
+                                                       .augmentation(FlowCapableNode).child(Table, new TableKey(OPENFLOWV10_TABLE_ID)).toInstance();
+               
+               val it = this.startChange();
+               
+               val table= it.readConfigurationData(tableRef) as Table;
+               
+               if(table != null){
+                       LOG.info("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
+                       
+                       for(mdsalFlow : table.flow){
+                               if(FromSalConversionsUtils.flowEquals(mdsalFlow, MDFlowMapping.toMDSalflow(targetFlow))){
+                                       val statsFromDataStore = mdsalFlow.getAugmentation(FlowStatisticsData) as FlowStatisticsData;
+                                       
+                                       if(statsFromDataStore != null){
+                                               LOG.debug("Found matching flow in the data store flow table ");
+                                               val it = new FlowOnNode(targetFlow);
+                                               byteCount =  statsFromDataStore.flowStatistics.byteCount.value.longValue;
+                                               packetCount = statsFromDataStore.flowStatistics.packetCount.value.longValue;
+                                               durationSeconds = statsFromDataStore.flowStatistics.duration.second.value.intValue;
+                                               durationNanoseconds = statsFromDataStore.flowStatistics.duration.nanosecond.value.intValue;
+                                               
+                                               ret = it;
+                                       }
+                               }                       
+                       }
+               }
+        
+        //TODO: Refer TODO (main)
+        val input = new GetFlowStatisticsFromFlowTableInputBuilder;
+        input.setNode(node.toNodeRef);
+        input.fieldsFrom(MDFlowMapping.toMDSalflow(targetFlow));
+        flowStatisticsService.getFlowStatisticsFromFlowTable(input.build)
+        
+        return ret;
+       
     }
 
-    override readFlow(Node node, Flow flow, boolean cached) {
-        val input = flowStatisticsInput(node, flow);
-        val output = flowStatisticsService.getFlowStatistics(input);
-
-        try {
-            val statistics = output.get().getResult();
-            if (statistics != null) {
-                val it = new FlowOnNode(flow);
-                byteCount = statistics.byteCount.value.longValue
-                durationNanoseconds = statistics.duration.getNanosecond().getValue().intValue();
-                durationSeconds = statistics.duration.getSecond().getValue().intValue();
-                packetCount = statistics.getPacketCount().getValue().longValue();
-                return it;
-            }
-        } catch (Exception e) {
-            LOG.error("Read flow not processed", e);
-        }
-        return null;
+    override readNodeConnector(org.opendaylight.controller.sal.core.NodeConnector connector, boolean cached) {
+       var NodeConnectorStatistics  nodeConnectorStatistics = null;
+       
+               val nodeConnectorRef = InstanceIdentifier.builder(Nodes)
+                                                                       .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(connector.node))
+                                                                       .child(NodeConnector, InventoryMapping.toNodeConnectorKey(connector))
+                                                                       .toInstance();
+               val provider = this.startChange();
+                               
+               val nodeConnectorFromDS = provider.readConfigurationData(nodeConnectorRef) as NodeConnector;
+                               
+               if(nodeConnectorFromDS != null){
+                       val nodeConnectorStatsFromDs = nodeConnectorFromDS.getAugmentation(FlowCapableNodeConnectorStatisticsData) as FlowCapableNodeConnectorStatistics;
+                       if(nodeConnectorStatsFromDs != null) {
+                               nodeConnectorStatistics = toNodeConnectorStatistics(nodeConnectorStatsFromDs.flowCapableNodeConnectorStatistics,
+                                                                                                                                               InventoryMapping.toNodeKey(connector.node).id,
+                                                                                                                                               InventoryMapping.toNodeConnectorKey(connector).id);
+                       }
+               }
+
+               //TODO: Refer TODO (main)
+        val input = new GetNodeConnectorStatisticsInputBuilder();
+        input.setNode(connector.node.toNodeRef);
+        input.setNodeConnectorId(InventoryMapping.toNodeConnectorKey(connector).id);
+        nodeConnectorStatisticsService.getNodeConnectorStatistics(input.build());
+        return nodeConnectorStatistics;
     }
 
-    override readNodeConnector(NodeConnector connector, boolean cached) {
-
-        val getNodeConnectorStatisticsInput = FromSalConversionsUtils.nodeConnectorStatistics(connector);
-        val future = flowStatisticsService.getNodeConnectorStatistics(getNodeConnectorStatisticsInput);
-        try {
-            val rpcResult = future.get();
-            val output = rpcResult.getResult();
-
-            if (output != null) {
-                return output.toNodeConnectorStatistics;
-            }
-        } catch (Exception e) {
-            LOG.error("Read node connector not processed", e);
-        }
-
-        return null;
+    override readNodeTable(NodeTable nodeTable, boolean cached) {
+       var NodeTableStatistics nodeStats = null
+       
+       val tableRef = InstanceIdentifier.builder(Nodes)
+                                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(nodeTable.node))
+                                                       .augmentation(FlowCapableNode).child(Table, new TableKey(nodeTable.ID as Short)).toInstance();
+               
+               val it = this.startChange();
+               
+               val table= it.readConfigurationData(tableRef) as Table;
+               
+               if(table != null){
+                       val tableStats = table.getAugmentation(FlowTableStatisticsData) as FlowTableStatisticsData;
+                               
+                       if(tableStats != null){
+                               nodeStats =  toNodeTableStatistics(tableStats.flowTableStatistics,table.id,nodeTable.node);
+                       }
+               }
+
+               //TODO: Refer TODO (main)
+        val input = new GetFlowTablesStatisticsInputBuilder();
+        input.setNode(nodeTable.node.toNodeRef);
+        flowTableStatisticsService.getFlowTablesStatistics(input.build);
+        
+        return nodeStats;
     }
 
     override onNodeConnectorRemoved(NodeConnectorRemoved update) {
@@ -157,33 +328,99 @@ class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInRead
     }
 
     override onNodeRemoved(NodeRemoved notification) {
-        // NOOP
+        val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
+
+        inventoryPublisher.updateNode(notification.nodeRef.toADNode, UpdateType.REMOVED, properties);
     }
 
     override onNodeConnectorUpdated(NodeConnectorUpdated update) {
-        val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
-        inventoryPublisher.updateNodeConnector(update.nodeConnectorRef.toADNodeConnector, UpdateType.CHANGED, properties);
+        var updateType = UpdateType.CHANGED;
+        if ( this._dataService.readOperationalData(update.nodeConnectorRef.value as InstanceIdentifier<? extends DataObject>) == null ){
+            updateType = UpdateType.ADDED;
+        }
+
+        var nodeConnector = update.nodeConnectorRef.toADNodeConnector
+
+        inventoryPublisher.updateNodeConnector(nodeConnector , updateType , update.toADNodeConnectorProperties);
     }
 
     override onNodeUpdated(NodeUpdated notification) {
         val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
-        inventoryPublisher.updateNode(notification.nodeRef.toADNode, UpdateType.CHANGED, properties);
+        val InstanceIdentifier<? extends DataObject> identifier = notification.nodeRef.value  as InstanceIdentifier<? extends DataObject>;
+
+        var updateType = UpdateType.CHANGED;
+        if ( this._dataService.readOperationalData(identifier) == null ){
+            updateType = UpdateType.ADDED;
+        }
+        inventoryPublisher.updateNode(notification.nodeRef.toADNode, updateType, notification.toADNodeProperties);
+        
+               //Notify the listeners of IPluginOutReadService
+        
+        for (statsPublisher : statisticsPublisher){
+                       val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
+                       statsPublisher.descriptionStatisticsUpdated(nodeRef.toADNode,toNodeDescription(notification.nodeRef));
+               }
     }
 
     override getNodeProps() {
-
-        // FIXME: Read from MD-SAL inventory service
-        return null;
+        val props = new ConcurrentHashMap<Node, Map<String, org.opendaylight.controller.sal.core.Property>>()
+        
+        val nodes = readAllMDNodes()
+        for (node : nodes.node ) {
+            val fcn = node.getAugmentation(FlowCapableNode)
+            if(fcn != null) {
+                val perNodeProps = fcn.toADNodeProperties(node.id)
+                val perNodePropMap = new ConcurrentHashMap<String, org.opendaylight.controller.sal.core.Property>
+                if(perNodeProps != null ) {
+                    for(perNodeProp : perNodeProps) {
+                        perNodePropMap.put(perNodeProp.name,perNodeProp)
+                    }
+                }
+                props.put(new Node(MD_SAL_TYPE, node.id.toADNodeId),perNodePropMap)
+            }
+        }
+        return props;
     }
-
-    override getNodeConnectorProps(Boolean refresh) {
-
-        // FIXME: Read from MD-SAL Invcentory Service
-        return null;
+    
+    private def readAllMDNodes() {
+        val nodesRef = InstanceIdentifier.builder(Nodes)
+            .toInstance
+        val reader = TypeSafeDataReader.forReader(dataService)
+        return reader.readOperationalData(nodesRef)
+    }
+    
+    private def readAllMDNodeConnectors(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node node) {
+        val nodeRef = InstanceIdentifier.builder(Nodes)
+            .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(node.id))
+            .toInstance
+        val reader = TypeSafeDataReader.forReader(dataService)
+        return reader.readOperationalData(nodeRef).nodeConnector
     }
 
-    override readNodeTable(NodeTable table, boolean cached) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    override getNodeConnectorProps(Boolean refresh) {
+        // Note, because the MD-SAL has a unified data store, we can ignore the Boolean refresh, as we have no secondary 
+        // data store to refresh from
+        val props = new ConcurrentHashMap<org.opendaylight.controller.sal.core.NodeConnector, Map<String, org.opendaylight.controller.sal.core.Property>>()
+        val nodes = readAllMDNodes()
+        for (node : nodes.node) {
+            val ncs = node.readAllMDNodeConnectors
+            if(ncs != null) {
+                for( nc : ncs ) {
+                    val fcnc = nc.getAugmentation(FlowCapableNodeConnector)
+                    if(fcnc != null) {
+                        val ncps = fcnc.toADNodeConnectorProperties
+                        val ncpsm = new ConcurrentHashMap<String, org.opendaylight.controller.sal.core.Property>
+                        if(ncps != null) {
+                            for(p : ncps) {
+                                ncpsm.put(p.name,p)
+                            }
+                        }  
+                        props.put(nc.id.toADNodeConnector(node.id),ncpsm)
+                    }
+                }
+            }
+        }
+        return props
     }
 
     private def FlowCapableNode readFlowCapableNode(NodeRef ref) {
@@ -196,57 +433,142 @@ class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInRead
     private def FlowCapableNodeConnector readFlowCapableNodeConnector(NodeConnectorRef ref) {
         val dataObject = dataService.readOperationalData(ref.value as InstanceIdentifier<? extends DataObject>);
         val node = dataObject.checkInstanceOf(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector);
+            NodeConnector);
         return node.getAugmentation(FlowCapableNodeConnector);
     }
 
-    private static def toNodeConnectorStatistics(
-        org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.NodeConnectorStatistics output) {
-        val it = new NodeConnectorStatistics
-
-        collisionCount = output.getCollisionCount().longValue();
-        receiveCRCErrorCount = output.getReceiveCrcError().longValue();
-        receiveFrameErrorCount = output.getReceiveFrameError().longValue();
-        receiveOverRunErrorCount = output.getReceiveOverRunError().longValue();
+    private def toNodeConnectorStatistics(
+        org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.NodeConnectorStatistics nodeConnectorStatistics, NodeId nodeId, NodeConnectorId nodeConnectorId) {
+               
+                       val it = new NodeConnectorStatistics();
+                       
+                       receivePacketCount = nodeConnectorStatistics.packets.received.longValue;
+                       transmitPacketCount = nodeConnectorStatistics.packets.transmitted.longValue;
+                       
+                       receiveByteCount = nodeConnectorStatistics.bytes.received.longValue;
+                       transmitByteCount = nodeConnectorStatistics.bytes.transmitted.longValue;
+                       
+                       receiveDropCount = nodeConnectorStatistics.receiveDrops.longValue;
+                       transmitDropCount = nodeConnectorStatistics.transmitDrops.longValue;
+                       
+                       receiveErrorCount = nodeConnectorStatistics.receiveErrors.longValue;
+                       transmitErrorCount = nodeConnectorStatistics.transmitErrors.longValue;
+                       
+                       receiveFrameErrorCount = nodeConnectorStatistics.receiveFrameError.longValue;
+                       receiveOverRunErrorCount = nodeConnectorStatistics.receiveOverRunError.longValue;
+                       receiveCRCErrorCount = nodeConnectorStatistics.receiveCrcError.longValue;
+                       collisionCount = nodeConnectorStatistics.collisionCount.longValue;
+                       
+                       val nodeConnectorRef = InstanceIdentifier.builder(Nodes)
+                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(nodeId))
+                                                               .child(NodeConnector,new NodeConnectorKey(nodeConnectorId)).toInstance;
+                       
+                       nodeConnector = NodeMapping.toADNodeConnector(new NodeConnectorRef(nodeConnectorRef));
+                       
+                       return it;
+    }
 
-        receiveDropCount = output.getReceiveDrops().longValue();
-        receiveErrorCount = output.getReceiveErrors().longValue();
-        receivePacketCount = output.getPackets().getReceived().longValue();
-        receiveByteCount = output.getBytes().getReceived().longValue();
+       private def toNodeTableStatistics(
+               FlowTableStatistics tableStats,
+               Short tableId,Node node){
+               var it = new NodeTableStatistics();
+               
+               activeCount = tableStats.activeFlows.value.intValue;
+               lookupCount = tableStats.packetsLookedUp.value.intValue;
+               matchedCount = tableStats.packetsMatched.value.intValue;
+               name = tableId.toString;
+               nodeTable = new NodeTable(NodeMapping.MD_SAL_TYPE,tableId,node);
+               return it;
+       }
+       
+       private def toNodeDescription(NodeRef nodeRef){
+               val capableNode = readFlowCapableNode(nodeRef);
 
-        transmitDropCount = output.getTransmitDrops().longValue();
-        transmitErrorCount = output.getTransmitErrors().longValue();
-        transmitPacketCount = output.getPackets().getTransmitted().longValue();
-        transmitByteCount = output.getBytes().getTransmitted().longValue();
+        val it = new NodeDescription()
+        manufacturer = capableNode.manufacturer
+        serialNumber = capableNode.serialNumber
+        software = capableNode.software
+        description = capableNode.description
+        
         return it;
-    }
-
-    override sollicitRefresh() {
-        topologyDiscovery.solicitRefresh
-    }
-    
-    override onLinkDiscovered(LinkDiscovered notification) {
-        val update = new TopoEdgeUpdate(notification.toADEdge,Collections.emptySet(),UpdateType.ADDED);
-        discoveryPublisher.notifyEdge(notification.toADEdge,UpdateType.ADDED,Collections.emptySet());
-        topologyPublisher.edgeUpdate(Collections.singletonList(update))
-    }
-    
-    override onLinkOverutilized(LinkOverutilized notification) {
-        topologyPublisher.edgeOverUtilized(notification.toADEdge)
-    }
-    
-    override onLinkRemoved(LinkRemoved notification) {
-        val update = new TopoEdgeUpdate(notification.toADEdge,Collections.emptySet(),UpdateType.REMOVED);
-        topologyPublisher.edgeUpdate(Collections.singletonList(update))
-    }
-    
-    override onLinkUtilizationNormal(LinkUtilizationNormal notification) {
-        topologyPublisher.edgeUtilBackToNormal(notification.toADEdge)
-    }
+       }
     
     
     def Edge toADEdge(Link link) {
         new Edge(link.source.toADNodeConnector,link.destination.toADNodeConnector)
     }
-
+       
+       /*
+        * OpendaylightFlowStatisticsListener interface implementation
+        */
+       override onAggregateFlowStatisticsUpdate(AggregateFlowStatisticsUpdate notification) {
+               throw new UnsupportedOperationException("TODO: auto-generated method stub")
+       }
+       
+       override onFlowsStatisticsUpdate(FlowsStatisticsUpdate notification) {
+               
+               val adsalFlowsStatistics = new ArrayList<FlowOnNode>();
+               
+               for(flowStats : notification.flowAndStatisticsMapList){
+                       if(flowStats.tableId == 0)
+                               adsalFlowsStatistics.add(toFlowOnNode(flowStats));
+               }
+               
+               for (statsPublisher : statisticsPublisher){
+                       val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
+                       statsPublisher.nodeFlowStatisticsUpdated(nodeRef.toADNode,adsalFlowsStatistics);
+               }
+               
+       }
+       /*
+        * OpendaylightFlowTableStatisticsListener interface implementation
+        */     
+       override onFlowTableStatisticsUpdate(FlowTableStatisticsUpdate notification) {
+               var adsalFlowTableStatistics = new ArrayList<NodeTableStatistics>();
+               
+               for(stats : notification.flowTableAndStatisticsMap){
+                       if (stats.tableId.value == 0){
+                               val it = new NodeTableStatistics();
+                               activeCount = stats.activeFlows.value.intValue;
+                               lookupCount = stats.packetsLookedUp.value.longValue;
+                               matchedCount = stats.packetsMatched.value.longValue;
+                               
+                               adsalFlowTableStatistics.add(it);
+                       }
+               }
+               for (statsPublisher : statisticsPublisher){
+                       val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
+                       statsPublisher.nodeTableStatisticsUpdated(nodeRef.toADNode,adsalFlowTableStatistics);
+               }
+       }
+       
+       /*
+        * OpendaylightPortStatisticsUpdate interface implementation
+        */
+       override onNodeConnectorStatisticsUpdate(NodeConnectorStatisticsUpdate notification) {
+               
+               val adsalPortStatistics  = new ArrayList<NodeConnectorStatistics>();
+               
+               for(nodeConnectorStatistics : notification.nodeConnectorStatisticsAndPortNumberMap){
+                       adsalPortStatistics.add(toNodeConnectorStatistics(nodeConnectorStatistics,notification.id,nodeConnectorStatistics.nodeConnectorId));
+               }
+               
+               for (statsPublisher : statisticsPublisher){
+                       val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
+                       statsPublisher.nodeConnectorStatisticsUpdated(nodeRef.toADNode,adsalPortStatistics);
+               }
+               
+       }
+       
+       private static def toFlowOnNode (FlowAndStatisticsMapList flowAndStatsMap){
+               
+               val it = new FlowOnNode(ToSalConversionsUtils.toFlow(flowAndStatsMap));
+               
+               byteCount = flowAndStatsMap.byteCount.value.longValue;
+               packetCount = flowAndStatsMap.packetCount.value.longValue;
+               durationSeconds = flowAndStatsMap.duration.second.value.intValue;
+               durationNanoseconds = flowAndStatsMap.duration.nanosecond.value.intValue;
+               
+               return it;
+       }
 }
index 6cf728c..b0f6065 100644 (file)
@@ -5,7 +5,6 @@ import java.math.BigInteger
 import java.net.Inet4Address
 import java.net.Inet6Address
 import java.util.ArrayList
-import java.util.List
 import org.opendaylight.controller.sal.action.Controller
 import org.opendaylight.controller.sal.action.Drop
 import org.opendaylight.controller.sal.action.Flood
@@ -40,7 +39,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddF
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder
 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.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.address.Address
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder
@@ -67,7 +65,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 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
@@ -106,6 +103,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 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
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
+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.FlowId
 
 public class MDFlowMapping {
 
@@ -130,34 +130,52 @@ public class MDFlowMapping {
         }
         instructions = targetActions.toApplyInstruction();
         match = sourceFlow.match.toMatch();
+        tableId = new Integer(0).shortValue
         return it.build();
 
     }
     
+    public static def toMDFlow(Flow sourceFlow) {
+       if (sourceFlow == null)
+            throw new IllegalArgumentException();
+       val it = new FlowBuilder();
+       hardTimeout = sourceFlow.hardTimeout as int
+       idleTimeout = sourceFlow.idleTimeout as int
+       cookie = BigInteger.valueOf(sourceFlow.id)
+       priority = sourceFlow.priority as int
+       id = new FlowId(sourceFlow.id)
+    
+       val sourceActions = sourceFlow.actions;
+       val targetActions = new ArrayList<Action>();
+       for (sourceAction : sourceActions) {
+           targetActions.add(sourceAction.toAction());
+       }
+       instructions = targetActions.toApplyInstruction();
+       match = sourceFlow.match.toMatch();
+       tableId = new Integer(0).shortValue
+       return it.build();
+    }
+    
     public static def Instructions toApplyInstruction(ArrayList<Action> actions) {
         val it = new InstructionsBuilder;
         val applyActions = new InstructionBuilder;
         applyActions.instruction = new ApplyActionsCaseBuilder().setApplyActions(new ApplyActionsBuilder().setAction(actions).build()).build()
+        applyActions.setOrder(new Integer(0))
         instruction = Collections.<Instruction>singletonList(applyActions.build)
         return it.build;
     }
 
-    public static def flowStatisticsInput(Node sourceNode, Flow sourceFlow) {
-        val source = flowAdded(sourceFlow);
-        val it = new GetFlowStatisticsInputBuilder(source as org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow);
-        node = sourceNode.toNodeRef();
-        return it.build();
-    }
-
     public static def removeFlowInput(Node sourceNode, Flow sourceFlow) {
         val source = flowAdded(sourceFlow);
         val it = new RemoveFlowInputBuilder(source as org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow);
+        node = sourceNode.toNodeRef()
         return it.build();
     }
 
     public static def addFlowInput(Node sourceNode, Flow sourceFlow) {
         val source = flowAdded(sourceFlow);
         val it = new AddFlowInputBuilder(source as org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow);
+        it.setNode(sourceNode.toNodeRef)
         return it.build();
     }
 
@@ -355,7 +373,7 @@ public class MDFlowMapping {
     }
 
     public static def Uri toUri(NodeConnector connector) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        return new NodeConnectorId(connector.ID as String);
     }
 
     public static def MacAddress toMacAddress(byte[] bytes) {
@@ -367,4 +385,25 @@ public class MDFlowMapping {
         }
         return new MacAddress(sb.toString());
     }
+       
+       public static def toMDSalflow(Flow sourceFlow) {
+        if (sourceFlow == null)
+            throw new IllegalArgumentException();
+        val it = new FlowBuilder();
+
+        hardTimeout = sourceFlow.hardTimeout as int
+        idleTimeout = sourceFlow.idleTimeout as int
+        cookie = BigInteger.valueOf(sourceFlow.id)
+        priority = sourceFlow.priority as int
+
+        val sourceActions = sourceFlow.actions;
+        val targetActions = new ArrayList<Action>();
+        for (sourceAction : sourceActions) {
+            targetActions.add(sourceAction.toAction());
+        }
+        instructions = targetActions.toApplyInstruction();
+        match = sourceFlow.match.toMatch();
+        return it.build();
+       }
+       
 }
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java
new file mode 100644 (file)
index 0000000..5b4b16a
--- /dev/null
@@ -0,0 +1,23 @@
+package org.opendaylight.controller.sal.compatibility;
+
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MDSalNodeConnectorFactory implements INodeConnectorFactory{
+    private Logger logger = LoggerFactory.getLogger(MDSalNodeConnectorFactory.class);
+
+    @Override
+    public NodeConnector fromStringNoNode(String type, String id, Node node) {
+        try {
+            return new NodeConnector(type, id, node);
+        } catch (ConstructionException e) {
+            logger.error("Could not construct NodeConnector", e);
+        }
+        return null;
+
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java
new file mode 100644 (file)
index 0000000..e36ebd7
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.sal.compatibility;
+
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.INodeFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MDSalNodeFactory implements INodeFactory{
+    private Logger logger = LoggerFactory.getLogger(MDSalNodeFactory.class);
+
+    @Override
+    public Node fromString(String type, String id) {
+
+        try {
+            return new Node(type, id);
+        } catch (ConstructionException e) {
+            logger.error("Could not construct Node", e);
+        }
+        return null;
+    }
+}
index 4c9a9e6..4378e7d 100644 (file)
@@ -7,13 +7,48 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableIt
 
 import static com.google.common.base.Preconditions.*;
 import static extension org.opendaylight.controller.sal.common.util.Arguments.*;
+import static extension org.opendaylight.controller.sal.compatibility.ToSalConversionsUtils.*;
 
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
 import org.opendaylight.controller.sal.core.ConstructionException
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdated
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures
+import org.opendaylight.controller.sal.core.Bandwidth
+import org.opendaylight.controller.sal.core.AdvertisedBandwidth
+import org.opendaylight.controller.sal.core.SupportedBandwidth
+import org.opendaylight.controller.sal.core.PeerBandwidth
+import org.opendaylight.controller.sal.core.Name
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig
+import org.opendaylight.controller.sal.core.Config
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated
+import java.util.HashSet
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdated
+import org.opendaylight.controller.sal.core.Tables
+import java.util.List
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FeatureCapability
+import org.opendaylight.controller.sal.core.Buffers
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityFlowStats
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityTableStats
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityIpReasm
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityPortStats
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityStp
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityQueueStats
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityArpMatchIp
+import org.opendaylight.controller.sal.core.Capabilities
+import org.opendaylight.controller.sal.core.MacAddress
+import java.util.Date
+import org.opendaylight.controller.sal.core.TimeStamp
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowNodeConnector
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowNode
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector
 
 public class NodeMapping {
 
@@ -27,29 +62,80 @@ public class NodeMapping {
     }
 
     public static def toADNode(InstanceIdentifier<?> node) throws ConstructionException {
+        return node.toNodeId.toADNode
+    }
+
+    public static def toADNode(NodeId id) {
+        return new Node(MD_SAL_TYPE, id.toADNodeId);
+    }
+
+    public static def toNodeId(InstanceIdentifier<?> node) {
         checkNotNull(node);
         checkNotNull(node.getPath());
         checkArgument(node.getPath().size() >= 2);
         val arg = node.getPath().get(1);
         val item = arg.checkInstanceOf(IdentifiableItem);
         val nodeKey = item.getKey().checkInstanceOf(NodeKey);
-        return new Node(MD_SAL_TYPE, nodeKey);
+        return nodeKey.id
+    }
+
+    public static def toADNodeId(NodeId nodeId) {
+        checkNotNull(nodeId);
+        return nodeId.value
     }
 
     public static def toADNodeConnector(NodeConnectorRef source) throws ConstructionException {
         checkNotNull(source);
         val InstanceIdentifier<?> path = checkNotNull(source.getValue());
-        val node = path.toADNode();
         checkArgument(path.path.size() >= 3);
         val arg = path.getPath().get(2);
         val item = arg.checkInstanceOf(IdentifiableItem);
         val connectorKey = item.getKey().checkInstanceOf(NodeConnectorKey);
-        return new NodeConnector(MD_SAL_TYPE, connectorKey, node);
+        return connectorKey.id.toADNodeConnector(path.toNodeId)
+    }
+    
+    public static def toADNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId ncid,
+        org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId nid) {
+            return new NodeConnector(ncid.toNodeConnectorType(nid),
+            ncid.toADNodeConnectorId(nid), nid.toADNode);
+     }
+
+    public static def toNodeConnectorType(NodeConnectorId ncId, NodeId nodeId) {
+        if (ncId.equals(nodeId.toLocalNodeConnectorId)) {
+            return NodeConnector.NodeConnectorIDType.SWSTACK
+        } else if (ncId.equals(nodeId.toNormalNodeConnectorId)) {
+            return NodeConnector.NodeConnectorIDType.HWPATH
+        } else if (ncId.equals(nodeId.toControllerNodeConnectorId)) {
+            return NodeConnector.NodeConnectorIDType.CONTROLLER
+        }
+        return MD_SAL_TYPE
+    }
+
+    public static def toADNodeConnectorId(NodeConnectorId nodeConnectorId, NodeId nodeId) {
+        if (nodeConnectorId.equals(nodeId.toLocalNodeConnectorId) ||
+            nodeConnectorId.equals(nodeId.toNormalNodeConnectorId) ||
+            nodeConnectorId.equals(nodeId.toControllerNodeConnectorId)) {
+            return NodeConnector.SPECIALNODECONNECTORID
+        }
+        return nodeConnectorId.value
+    }
+
+    public static def toControllerNodeConnectorId(NodeId node) {
+        return new NodeConnectorId(node.value + ":" + 4294967293L)
+    }
+
+    public static def toLocalNodeConnectorId(NodeId node) {
+        return new NodeConnectorId(node.value + ":" + 4294967294L)
+    }
+
+    public static def toNormalNodeConnectorId(NodeId node) {
+        return new NodeConnectorId(node.value + ":" + 4294967290L)
     }
 
     public static def toNodeRef(Node node) {
         checkArgument(MD_SAL_TYPE.equals(node.getType()));
-        val nodeKey = node.ID.checkInstanceOf(NodeKey);
+        var nodeId = node.ID.checkInstanceOf(String)
+        val nodeKey = new NodeKey(new NodeId(nodeId));
         val nodePath = InstanceIdentifier.builder().node(Nodes).child(NODE_CLASS, nodeKey).toInstance();
         return new NodeRef(nodePath);
     }
@@ -57,7 +143,19 @@ public class NodeMapping {
     public static def toNodeConnectorRef(NodeConnector nodeConnector) {
         val node = nodeConnector.node.toNodeRef();
         val nodePath = node.getValue() as InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node>
-        val connectorKey = nodeConnector.ID.checkInstanceOf(NodeConnectorKey);
+        var NodeConnectorId nodeConnectorId
+        if (nodeConnector.ID.equals(NodeConnector.SPECIALNODECONNECTORID)) {
+            if (nodeConnector.type.equals(NodeConnector.NodeConnectorIDType.SWSTACK)) {
+                nodeConnectorId = nodePath.toNodeId.toLocalNodeConnectorId
+            } else if (nodeConnector.type.equals(NodeConnector.NodeConnectorIDType.HWPATH)) {
+                nodeConnectorId = nodePath.toNodeId.toNormalNodeConnectorId
+            } else if (nodeConnector.type.equals(NodeConnector.NodeConnectorIDType.CONTROLLER)) {
+                nodeConnectorId = nodePath.toNodeId.toControllerNodeConnectorId
+            }
+        } else {
+            nodeConnectorId = new NodeConnectorId(nodeConnector.ID.checkInstanceOf(String))
+        }
+        val connectorKey = new NodeConnectorKey(nodeConnectorId);
         val path = InstanceIdentifier.builder(nodePath).child(NODECONNECTOR_CLASS, connectorKey).toInstance();
         return new NodeConnectorRef(path);
     }
@@ -66,4 +164,194 @@ public class NodeMapping {
         return toADNode(node.getValue());
     }
 
+    public static def toADNodeConnectorProperties(NodeConnectorUpdated nc) {
+        val fcncu = nc.getAugmentation(FlowCapableNodeConnectorUpdated)
+        if (fcncu != null) {
+            return fcncu.toADNodeConnectorProperties
+        }
+        return new HashSet<org.opendaylight.controller.sal.core.Property>();
+    }
+
+    public static def toADNodeConnectorProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc) {
+        val fcnc = nc.getAugmentation(FlowCapableNodeConnector)
+        if (fcnc != null) {
+            return fcnc.toADNodeConnectorProperties
+        }
+        return new HashSet<org.opendaylight.controller.sal.core.Property>();
+    }
+
+    public static def toADNodeConnectorProperties(FlowNodeConnector fcncu) {
+        val props = new HashSet<org.opendaylight.controller.sal.core.Property>();
+        if (fcncu != null) {
+            if (fcncu.currentFeature != null && fcncu.currentFeature.toAdBandwidth != null) {
+                props.add(fcncu.currentFeature.toAdBandwidth)
+            }
+            if (fcncu.advertisedFeatures != null && fcncu.advertisedFeatures.toAdAdvertizedBandwidth != null) {
+                props.add(fcncu.advertisedFeatures.toAdAdvertizedBandwidth)
+            }
+            if (fcncu.supported != null && fcncu.supported.toAdSupportedBandwidth != null) {
+                props.add(fcncu.supported.toAdSupportedBandwidth)
+            }
+            if (fcncu.peerFeatures != null && fcncu.peerFeatures.toAdPeerBandwidth != null) {
+                props.add(fcncu.peerFeatures.toAdPeerBandwidth)
+            }
+            if (fcncu.name != null && fcncu.name.toAdName != null) {
+                props.add(fcncu.name.toAdName)
+            }
+            if (fcncu.configuration != null && fcncu.configuration.toAdConfig != null) {
+                props.add(fcncu.configuration.toAdConfig)
+            }
+            if (fcncu.state != null && fcncu.state.toAdState != null) {
+                props.add(fcncu.state.toAdState)
+            }
+        }
+        return props
+    }
+
+    public static def toAdName(String name) {
+        return new Name(name)
+    }
+
+    public static def toAdConfig(PortConfig pc) {
+        var Config config;
+        if (pc.PORTDOWN) {
+            config = new Config(Config.ADMIN_DOWN)
+        } else {
+            config = new Config(Config.ADMIN_UP)
+        }
+        return config
+    }
+
+    public static def toAdState(State s) {
+        var org.opendaylight.controller.sal.core.State state
+        if (s.linkDown) {
+            state = new org.opendaylight.controller.sal.core.State(org.opendaylight.controller.sal.core.State.EDGE_DOWN)
+        } else {
+            state = new org.opendaylight.controller.sal.core.State(org.opendaylight.controller.sal.core.State.EDGE_UP)
+        }
+        return state
+    }
+
+    public static def toAdBandwidth(PortFeatures pf) {
+        var Bandwidth bw = null
+        if (pf.is_10mbHd || pf.is_10mbFd) {
+            bw = new Bandwidth(Bandwidth.BW10Mbps)
+        } else if (pf.is_100mbHd || pf.is_100mbFd) {
+            bw = new Bandwidth(Bandwidth.BW100Mbps)
+        } else if (pf.is_1gbHd || pf.is_1gbFd) {
+            bw = new Bandwidth(Bandwidth.BW1Gbps)
+        } else if (pf.is_1gbFd) {
+            bw = new Bandwidth(Bandwidth.BW10Gbps)
+        } else if (pf.is_10gbFd) {
+            bw = new Bandwidth(Bandwidth.BW10Gbps)
+        } else if (pf.is_40gbFd) {
+            bw = new Bandwidth(Bandwidth.BW40Gbps)
+        } else if (pf.is_100gbFd) {
+            bw = new Bandwidth(Bandwidth.BW100Gbps)
+        } else if (pf.is_1tbFd) {
+            bw = new Bandwidth(Bandwidth.BW1Tbps)
+        }
+        return bw;
+    }
+
+    public static def toAdAdvertizedBandwidth(PortFeatures pf) {
+        var AdvertisedBandwidth abw
+        val bw = pf.toAdBandwidth
+        if (bw != null) {
+            abw = new AdvertisedBandwidth(bw.value)
+        }
+        return abw
+    }
+
+    public static def toAdSupportedBandwidth(PortFeatures pf) {
+        var SupportedBandwidth sbw
+        val bw = pf.toAdBandwidth
+        if (bw != null) {
+            sbw = new SupportedBandwidth(bw.value)
+        }
+        return sbw
+    }
+
+    public static def toAdPeerBandwidth(PortFeatures pf) {
+        var PeerBandwidth pbw
+        val bw = pf.toAdBandwidth
+        if (bw != null) {
+            pbw = new PeerBandwidth(bw.value)
+        }
+        return pbw
+    }
+
+    public static def toADNodeProperties(NodeUpdated nu) {
+        val fcnu = nu.getAugmentation(FlowCapableNodeUpdated)
+        if (fcnu != null) {
+            return fcnu.toADNodeProperties(nu.id)
+        }
+        return new HashSet<org.opendaylight.controller.sal.core.Property>();
+
+    }
+
+    public static def toADNodeProperties(FlowNode fcnu, NodeId id) {
+        val props = new HashSet<org.opendaylight.controller.sal.core.Property>();
+        if (fcnu != null) {
+            props.add(toADTimestamp)
+
+            // props.add(fcnu.supportedActions.toADActions) - TODO
+            if (id != null) {
+                props.add(id.toADMacAddress)
+            }
+            if (fcnu.switchFeatures != null) {
+                if (fcnu.switchFeatures.maxTables != null) {
+                    props.add(fcnu.switchFeatures.maxTables.toADTables)
+                }
+                if (fcnu.switchFeatures.capabilities != null) {
+                    props.add(fcnu.switchFeatures.capabilities.toADCapabiliities)
+                }
+                if (fcnu.switchFeatures.maxBuffers != null) {
+                    props.add(fcnu.switchFeatures.maxBuffers.toADBuffers)
+                }
+            }
+        }
+        return props;
+    }
+
+    public static def toADTimestamp() {
+        val date = new Date();
+        val timestamp = new TimeStamp(date.time, "connectedSince")
+        return timestamp;
+    }
+
+    public static def toADMacAddress(NodeId id) {
+        return new MacAddress(Long.parseLong(id.value.replaceAll("openflow:", "")).longValue.bytesFromDpid)
+    }
+
+    public static def toADTables(Short tables) {
+        return new Tables(tables.byteValue)
+    }
+
+    public static def toADCapabiliities(List<Class<? extends FeatureCapability>> capabilities) {
+        var int b
+        for (capability : capabilities) {
+            if (capability.equals(FlowFeatureCapabilityFlowStats)) {
+                b = Capabilities.CapabilitiesType.FLOW_STATS_CAPABILITY.value.bitwiseOr(b)
+            } else if (capability.equals(FlowFeatureCapabilityTableStats)) {
+                b = Capabilities.CapabilitiesType.TABLE_STATS_CAPABILITY.value.bitwiseOr(b)
+            } else if (capability.equals(FlowFeatureCapabilityPortStats)) {
+                b = Capabilities.CapabilitiesType.PORT_STATS_CAPABILITY.value.bitwiseOr(b)
+            } else if (capability.equals(FlowFeatureCapabilityStp)) {
+                b = Capabilities.CapabilitiesType.STP_CAPABILITY.value.bitwiseOr(b)
+            } else if (capability.equals(FlowFeatureCapabilityIpReasm)) {
+                b = Capabilities.CapabilitiesType.IP_REASSEM_CAPABILITY.value.bitwiseOr(b)
+            } else if (capability.equals(FlowFeatureCapabilityQueueStats)) {
+                b = Capabilities.CapabilitiesType.QUEUE_STATS_CAPABILITY.value.bitwiseOr(b)
+            } else if (capability.equals(FlowFeatureCapabilityArpMatchIp)) {
+                b = Capabilities.CapabilitiesType.ARP_MATCH_IP_CAPABILITY.value.bitwiseOr(b)
+            }
+        }
+        return new Capabilities(b)
+    }
+
+    public static def toADBuffers(Long buffers) {
+        return new Buffers(buffers.intValue)
+    }
+
 }
index a8349be..46fd62f 100644 (file)
@@ -1,6 +1,25 @@
 package org.opendaylight.controller.sal.compatibility;
 
-import com.google.common.net.InetAddresses;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
+import static org.opendaylight.controller.sal.match.MatchType.DL_DST;
+import static org.opendaylight.controller.sal.match.MatchType.DL_SRC;
+import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE;
+import static org.opendaylight.controller.sal.match.MatchType.DL_VLAN;
+import static org.opendaylight.controller.sal.match.MatchType.DL_VLAN_PR;
+import static org.opendaylight.controller.sal.match.MatchType.NW_DST;
+import static org.opendaylight.controller.sal.match.MatchType.NW_PROTO;
+import static org.opendaylight.controller.sal.match.MatchType.NW_SRC;
+import static org.opendaylight.controller.sal.match.MatchType.NW_TOS;
+import static org.opendaylight.controller.sal.match.MatchType.TP_DST;
+import static org.opendaylight.controller.sal.match.MatchType.TP_SRC;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import org.opendaylight.controller.sal.action.Controller;
 import org.opendaylight.controller.sal.action.Drop;
@@ -24,6 +43,7 @@ import org.opendaylight.controller.sal.action.SetVlanCfi;
 import org.opendaylight.controller.sal.action.SetVlanId;
 import org.opendaylight.controller.sal.action.SetVlanPcp;
 import org.opendaylight.controller.sal.action.SwPath;
+import org.opendaylight.controller.sal.core.Capabilities;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
 import org.opendaylight.controller.sal.match.Match;
@@ -33,7 +53,6 @@ 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.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.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.ControllerActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
@@ -67,6 +86,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 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.inventory.rev130819.FeatureCapability;
 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;
@@ -88,26 +108,7 @@ 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.UdpMatch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId;
 
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
-import static org.opendaylight.controller.sal.match.MatchType.DL_DST;
-import static org.opendaylight.controller.sal.match.MatchType.DL_SRC;
-import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE;
-import static org.opendaylight.controller.sal.match.MatchType.DL_VLAN;
-import static org.opendaylight.controller.sal.match.MatchType.DL_VLAN_PR;
-import static org.opendaylight.controller.sal.match.MatchType.NW_DST;
-import static org.opendaylight.controller.sal.match.MatchType.NW_PROTO;
-import static org.opendaylight.controller.sal.match.MatchType.NW_SRC;
-import static org.opendaylight.controller.sal.match.MatchType.NW_TOS;
-import static org.opendaylight.controller.sal.match.MatchType.TP_DST;
-import static org.opendaylight.controller.sal.match.MatchType.TP_SRC;
+import com.google.common.net.InetAddresses;
 
 public class ToSalConversionsUtils {
 
@@ -484,11 +485,11 @@ public class ToSalConversionsUtils {
     private static void fillFromArp(Match target, ArpMatch source) {
         Ipv4Prefix sourceAddress = source.getArpSourceTransportAddress();
         if (sourceAddress != null) {
-            target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null);
+            target.setField(NW_SRC, inetAddressFrom(sourceAddress), null);
         }
         Ipv4Prefix destAddress = source.getArpTargetTransportAddress();
         if (destAddress != null) {
-            target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null);
+            target.setField(NW_DST, inetAddressFrom(destAddress), null);
         }
         ArpSourceHardwareAddress sourceHwAddress = source.getArpSourceHardwareAddress();
         if (sourceHwAddress != null) {
@@ -506,22 +507,22 @@ public class ToSalConversionsUtils {
     private static void fillFromIpv6(Match target, Ipv6Match source) {
         Ipv6Prefix sourceAddress = source.getIpv6Source();
         if (sourceAddress != null) {
-            target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null);
+            target.setField(NW_SRC, inetAddressFrom(sourceAddress), null);
         }
         Ipv6Prefix destAddress = source.getIpv6Destination();
         if (destAddress != null) {
-            target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null);
+            target.setField(NW_DST, inetAddressFrom(destAddress), null);
         }
     }
 
     private static void fillFromIpv4(Match target, Ipv4Match source) {
         Ipv4Prefix sourceAddress = source.getIpv4Source();
         if (sourceAddress != null) {
-            target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null);
+            target.setField(NW_SRC, inetAddressFrom(sourceAddress), null);
         }
         Ipv4Prefix destAddress = source.getIpv4Destination();
         if (destAddress != null) {
-            target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null);
+            target.setField(NW_DST, inetAddressFrom(destAddress), null);
         }
     }
 
@@ -564,7 +565,7 @@ public class ToSalConversionsUtils {
         }
     }
 
-    private static byte[] bytesFrom(MacAddress address) {
+    public static byte[] bytesFrom(MacAddress address) {
         String[] mac = address.getValue().split(":");
         byte[] macAddress = new byte[6]; // mac.length == 6 bytes
         for (int i = 0; i < mac.length; i++) {
@@ -572,4 +573,15 @@ public class ToSalConversionsUtils {
         }
         return macAddress;
     }
+    
+    public static byte[] bytesFromDpid(long dpid) {
+        byte[] mac = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+        for (short i = 0; i < 6; i++) {
+            mac[5 - i] = (byte) dpid;
+            dpid >>= 8;
+        }
+
+        return mac;
+    }
 }
index 09585d6..149544b 100644 (file)
@@ -8,6 +8,8 @@ import java.util.concurrent.Future;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.common.util.Futures;
 import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.controller.sal.compatibility.FromSalConversionsUtils;
+import org.opendaylight.controller.sal.compatibility.InventoryMapping;
 import org.opendaylight.controller.sal.compatibility.NodeMapping;
 import org.opendaylight.controller.sal.compatibility.ToSalConversionsUtils;
 import org.opendaylight.controller.sal.core.ConstructionException;
@@ -19,87 +21,78 @@ import org.opendaylight.controller.sal.reader.IReadServiceListener;
 import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
 import org.opendaylight.controller.sal.reader.NodeDescription;
 import org.opendaylight.controller.sal.reader.NodeTableStatistics;
+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.statistics.rev130819.FlowStatisticsUpdatedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowTableStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowTableStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowTableStatisticsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.NodeConnectorStatisticsUpdatedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.flow.statistics.output.FlowStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.flow.statistics.output.FlowStatisticsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatisticsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.statistics.Duration;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.statistics.DurationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Bytes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Packets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService, IReadServiceListener {
+public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService, IReadServiceListener{
 
     private static final Logger LOG = LoggerFactory.getLogger(FlowStatisticsAdapter.class);
     private IReadService readDelegate;
     private NotificationProviderService notifier;
 
     @Override
-    public Future<RpcResult<GetAllFlowStatisticsOutput>> getAllFlowStatistics(GetAllFlowStatisticsInput input) {
-        GetAllFlowStatisticsOutput rpcResultType = null;
-        boolean rpcResultBool = false;
-
-        try {
-            Node adNode = NodeMapping.toADNode(input.getNode());
-            List<FlowOnNode> flowsOnNode = readDelegate.readAllFlows(adNode);
-            List<FlowStatistics> flowsStatistics = toOdFlowsStatistics(flowsOnNode);
-            GetAllFlowStatisticsOutputBuilder builder = new GetAllFlowStatisticsOutputBuilder();
-            rpcResultType = builder.setFlowStatistics(flowsStatistics).build();
-            rpcResultBool = true;
-        } catch (ConstructionException e) {
-            LOG.error(e.getMessage());
-        }
+    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
+            GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
+        //TODO: No supported API exist in AD-SAL, it can either be implemented by fetching all the stats of the flows and 
+        // generating aggregate flow statistics out of those individual flow stats.
+        return null;
+    }
 
-        return Futures.immediateFuture(Rpcs.getRpcResult(rpcResultBool, rpcResultType, null));
+    @Override
+    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
+            GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
+        //TODO: No supported API exist in AD-SAL, it can either be implemented by fetching all the stats of the flows and 
+        // generating aggregate flow statistics out of those individual flow stats.
+        return null;
     }
 
     @Override
-    public Future<RpcResult<GetAllNodeConnectorStatisticsOutput>> getAllNodeConnectorStatistics(
-            GetAllNodeConnectorStatisticsInput input) {
-        GetAllNodeConnectorStatisticsOutput rpcResultType = null;
+    public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
+            GetAllFlowStatisticsFromFlowTableInput input) {
+        GetAllFlowStatisticsFromFlowTableOutput rpcResultType = null;
         boolean rpcResultBool = false;
 
         try {
             Node adNode = NodeMapping.toADNode(input.getNode());
-            List<NodeConnectorStatistics> nodesConnectorStatistics = readDelegate.readNodeConnectors(adNode);
-            List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics> odNodesConnectorStatistics;
-            odNodesConnectorStatistics = toOdNodesConnectorStatistics(nodesConnectorStatistics);
-            GetAllNodeConnectorStatisticsOutputBuilder builder = new GetAllNodeConnectorStatisticsOutputBuilder();
-            rpcResultType = builder.setNodeConnectorStatistics(odNodesConnectorStatistics).build();
+            List<FlowOnNode> flowsOnNode = readDelegate.readAllFlows(adNode);
+            List<FlowAndStatisticsMapList> flowsStatistics = toOdFlowsStatistics(flowsOnNode);
+            GetAllFlowStatisticsFromFlowTableOutputBuilder builder = new GetAllFlowStatisticsFromFlowTableOutputBuilder();
+            builder.setTransactionId(new TransactionId(new BigInteger("0")));
+            rpcResultType = builder.setFlowAndStatisticsMapList(flowsStatistics).build();
+            
             rpcResultBool = true;
         } catch (ConstructionException e) {
             LOG.error(e.getMessage());
@@ -108,17 +101,24 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
         return Futures.immediateFuture(Rpcs.getRpcResult(rpcResultBool, rpcResultType, null));
     }
 
+    /**
+     * Essentially this API will return the same result as getAllFlowStatisticsFromFlowTable
+     */
     @Override
-    public Future<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput input) {
-        GetFlowStatisticsOutput rpcResultType = null;
+    public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
+            GetAllFlowsStatisticsFromAllFlowTablesInput input) {
+        
+        GetAllFlowsStatisticsFromAllFlowTablesOutput rpcResultType = null;
         boolean rpcResultBool = false;
 
         try {
-            Node node = NodeMapping.toADNode(input.getNode());
-            Flow flow = ToSalConversionsUtils.toFlow(input);
-            FlowOnNode readFlow = readDelegate.readFlow(node, flow);
-            FlowStatistics flowOnNodeToFlowStatistics = toOdFlowStatistics(readFlow);
-            rpcResultType = new GetFlowStatisticsOutputBuilder(flowOnNodeToFlowStatistics).build();
+            Node adNode = NodeMapping.toADNode(input.getNode());
+            List<FlowOnNode> flowsOnNode = readDelegate.readAllFlows(adNode);
+            List<FlowAndStatisticsMapList> flowsStatistics = toOdFlowsStatistics(flowsOnNode);
+            GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder builder = new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder();
+            builder.setTransactionId(new TransactionId(new BigInteger("0")));
+            rpcResultType = builder.setFlowAndStatisticsMapList(flowsStatistics).build();
+            
             rpcResultBool = true;
         } catch (ConstructionException e) {
             LOG.error(e.getMessage());
@@ -128,38 +128,18 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     }
 
     @Override
-    public Future<RpcResult<GetFlowTableStatisticsOutput>> getFlowTableStatistics(GetFlowTableStatisticsInput input) {
-        GetFlowTableStatisticsOutput rpcResultType = null;
+    public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
+            GetFlowStatisticsFromFlowTableInput input) {
+        GetFlowStatisticsFromFlowTableOutput rpcResultType = null;
         boolean rpcResultBool = false;
 
         try {
             Node node = NodeMapping.toADNode(input.getNode());
-            List<NodeTableStatistics> nodesTable = readDelegate.readNodeTable(node);
-            NodeTableStatistics nodeTable = null;
-            if (!nodesTable.isEmpty()) {
-                nodeTable = nodesTable.get(0);
-                rpcResultType = toOdTableStatistics(nodeTable);
-                rpcResultBool = true;
-            }
-        } catch (ConstructionException e) {
-            LOG.error(e.getMessage());
-        }
-
-        return Futures.immediateFuture(Rpcs.getRpcResult(rpcResultBool, rpcResultType, null));
-    }
-
-    @Override
-    public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
-            GetNodeConnectorStatisticsInput input) {
-        GetNodeConnectorStatisticsOutput rpcResultType = null;
-        boolean rpcResultBool = false;
-
-        NodeConnectorRef nodeConnector = input.getNodeConnector();
-        try {
-            NodeConnectorStatistics nodeConnectorStats = readDelegate.readNodeConnector(NodeMapping
-                    .toADNodeConnector(nodeConnector));
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics odNodeConnectorStatistics = toOdNodeConnectorStatistics(nodeConnectorStats);
-            rpcResultType = new GetNodeConnectorStatisticsOutputBuilder(odNodeConnectorStatistics).build();
+            Flow flow = ToSalConversionsUtils.toFlow(input);
+            FlowOnNode readFlow = readDelegate.readFlow(node, flow);
+            List<FlowAndStatisticsMapList> flowOnNodeToFlowStatistics = new ArrayList<FlowAndStatisticsMapList>();
+            flowOnNodeToFlowStatistics.add(toOdFlowStatistics(readFlow));
+            rpcResultType = new GetFlowStatisticsFromFlowTableOutputBuilder().setFlowAndStatisticsMapList(flowOnNodeToFlowStatistics).build();
             rpcResultBool = true;
         } catch (ConstructionException e) {
             LOG.error(e.getMessage());
@@ -169,59 +149,74 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     }
 
     @Override
-    public void descriptionStatisticsUpdated(Node node, NodeDescription nodeDescription) {
-
-        // TODO which *StatisticsUpdated interface should be used?
-
+    public void nodeFlowStatisticsUpdated(Node node, List<FlowOnNode> flowStatsList) {
+        List<FlowAndStatisticsMapList> flowStatistics = toOdFlowsStatistics(flowStatsList);
+        FlowsStatisticsUpdateBuilder flowsStatisticsUpdateBuilder = new FlowsStatisticsUpdateBuilder();
+        flowsStatisticsUpdateBuilder.setFlowAndStatisticsMapList(flowStatistics);
+        flowsStatisticsUpdateBuilder.setMoreReplies(false);
+        flowsStatisticsUpdateBuilder.setTransactionId(null);
+        flowsStatisticsUpdateBuilder.setId(InventoryMapping.toNodeKey(node).getId());
+        notifier.publish(flowsStatisticsUpdateBuilder.build());
     }
 
     @Override
     public void nodeConnectorStatisticsUpdated(Node node, List<NodeConnectorStatistics> ncStatsList) {
-        for (NodeConnectorStatistics ndConStats : ncStatsList) {
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics odNodeConnectorStatistics;
-            odNodeConnectorStatistics = toOdNodeConnectorStatistics(ndConStats);
-            NodeConnectorStatisticsUpdatedBuilder statisticsBuilder = new NodeConnectorStatisticsUpdatedBuilder(
-                    odNodeConnectorStatistics);
-            notifier.publish(statisticsBuilder.build());
-        }
-    }
-
-    @Override
-    public void nodeFlowStatisticsUpdated(Node node, List<FlowOnNode> flowStatsList) {
-        for (FlowOnNode flowOnNode : flowStatsList) {
-            FlowStatistics flowStatistics = toOdFlowStatistics(flowOnNode);
-            FlowStatisticsUpdatedBuilder statisticsBuilder = new FlowStatisticsUpdatedBuilder(flowStatistics);
-            notifier.publish(statisticsBuilder.build());
-        }
+        NodeConnectorStatisticsUpdateBuilder nodeConnectorStatisticsUpdateBuilder = new NodeConnectorStatisticsUpdateBuilder();
+        List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatistics = toOdNodeConnectorStatistics(ncStatsList);
+        
+        nodeConnectorStatisticsUpdateBuilder.setNodeConnectorStatisticsAndPortNumberMap(nodeConnectorStatistics);
+        nodeConnectorStatisticsUpdateBuilder.setMoreReplies(false);
+        nodeConnectorStatisticsUpdateBuilder.setTransactionId(null);
+        nodeConnectorStatisticsUpdateBuilder.setId(InventoryMapping.toNodeKey(node).getId());
+        notifier.publish(nodeConnectorStatisticsUpdateBuilder.build());
     }
 
     @Override
     public void nodeTableStatisticsUpdated(Node node, List<NodeTableStatistics> tableStatsList) {
-        // TODO : Not implemented by AD-SAL.
+        
+        FlowTableStatisticsUpdateBuilder flowTableStatisticsUpdateBuilder = new FlowTableStatisticsUpdateBuilder();  
+        
+        List<FlowTableAndStatisticsMap>  flowTableStatistics = toOdFlowTableStatistics(tableStatsList);
+        flowTableStatisticsUpdateBuilder.setFlowTableAndStatisticsMap(flowTableStatistics);
+        flowTableStatisticsUpdateBuilder.setMoreReplies(false);
+        flowTableStatisticsUpdateBuilder.setTransactionId(null);
+        flowTableStatisticsUpdateBuilder.setId(InventoryMapping.toNodeKey(node).getId());
+        notifier.publish(flowTableStatisticsUpdateBuilder.build());
+}
+
+        @Override
+    public void descriptionStatisticsUpdated(Node node, NodeDescription nodeDescription) {
+            // TODO which *StatisticsUpdated interface should be used?
+        
     }
 
-    private List<FlowStatistics> toOdFlowsStatistics(List<FlowOnNode> flowsOnNode) {
-        List<FlowStatistics> flowsStatistics = new ArrayList<>();
+    private List<FlowAndStatisticsMapList> toOdFlowsStatistics(List<FlowOnNode> flowsOnNode) {
+        List<FlowAndStatisticsMapList> flowsStatistics = new ArrayList<>();
         for (FlowOnNode flowOnNode : flowsOnNode) {
             flowsStatistics.add(toOdFlowStatistics(flowOnNode));
         }
         return flowsStatistics;
     }
 
-    private FlowStatistics toOdFlowStatistics(FlowOnNode flowOnNode) {
-        FlowStatisticsBuilder builder = new FlowStatisticsBuilder();
+    private FlowAndStatisticsMapList toOdFlowStatistics(FlowOnNode flowOnNode) {
+        FlowAndStatisticsMapListBuilder builder = new FlowAndStatisticsMapListBuilder();
 
         builder.setByteCount(toCounter64(flowOnNode.getByteCount()));
         builder.setPacketCount(toCounter64(flowOnNode.getPacketCount()));
         builder.setDuration(extractDuration(flowOnNode));
-
+        builder.setMatch(FromSalConversionsUtils.toMatch(flowOnNode.getFlow().getMatch()));
+        builder.setPriority((int)flowOnNode.getFlow().getPriority());
+        builder.setHardTimeout((int)flowOnNode.getFlow().getHardTimeout());
+        builder.setIdleTimeout((int)flowOnNode.getFlow().getIdleTimeout());
+        //TODO: actions to instruction conversion
+        builder.setInstructions(null);
         return builder.build();
     }
 
-    private Duration extractDuration(FlowOnNode flowOnNode) {
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.Duration extractDuration(FlowOnNode flowOnNode) {
         DurationBuilder builder = new DurationBuilder();
-        builder.setNanosecond(toCounter64(flowOnNode.getDurationNanoseconds()));
-        builder.setSecond(toCounter64(flowOnNode.getDurationSeconds()));
+        builder.setNanosecond(new Counter32((long)flowOnNode.getDurationNanoseconds()));
+        builder.setSecond(new Counter32((long)flowOnNode.getDurationSeconds()));
         return builder.build();
     }
 
@@ -231,38 +226,43 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
         return new Counter64(byteCountBigInt);
     }
 
-    private Counter64 toCounter64(int num) {
-        String byteCountStr = String.valueOf(num);
-        BigInteger byteCountBigInt = new BigInteger(byteCountStr);
-        return new Counter64(byteCountBigInt);
-    }
-
-    private List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics> toOdNodesConnectorStatistics(
-            List<NodeConnectorStatistics> nodesConnectorStatistics) {
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics> odNodesConnectorStatistics = new ArrayList<>();
-        for (NodeConnectorStatistics nodeConnectorStatistics : nodesConnectorStatistics) {
-            odNodesConnectorStatistics.add(toOdNodeConnectorStatistics(nodeConnectorStatistics));
+    private List<FlowTableAndStatisticsMap> toOdFlowTableStatistics(List<NodeTableStatistics> tableStatsList) {
+        
+        List<FlowTableAndStatisticsMap> flowTableStatsMap = new ArrayList<FlowTableAndStatisticsMap>();
+        for (NodeTableStatistics nodeTableStatistics : tableStatsList) {
+            FlowTableAndStatisticsMapBuilder flowTableAndStatisticsMapBuilder = new FlowTableAndStatisticsMapBuilder();
+            flowTableAndStatisticsMapBuilder.setActiveFlows(new Counter32((long) nodeTableStatistics.getActiveCount()));
+            flowTableAndStatisticsMapBuilder.setPacketsLookedUp(toCounter64(nodeTableStatistics.getLookupCount()));
+            flowTableAndStatisticsMapBuilder.setPacketsMatched(toCounter64(nodeTableStatistics.getMatchedCount()));
+            flowTableAndStatisticsMapBuilder.setActiveFlows(new Counter32((long) nodeTableStatistics.getActiveCount()));
+            flowTableAndStatisticsMapBuilder.setTableId(new TableId((short)nodeTableStatistics.getNodeTable().getID()));
+            flowTableStatsMap.add(flowTableAndStatisticsMapBuilder.build());
         }
-        return odNodesConnectorStatistics;
+        
+        return flowTableStatsMap;
     }
 
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics toOdNodeConnectorStatistics(
-            NodeConnectorStatistics ndConStats) {
-        NodeConnectorStatisticsBuilder builder = new NodeConnectorStatisticsBuilder();
-
-        builder.setBytes(extractBytes(ndConStats));
-        builder.setCollisionCount(toBI(ndConStats.getCollisionCount()));
-        builder.setDuration(null);
-        builder.setPackets(extractPackets(ndConStats));
-        builder.setReceiveCrcError(toBI(ndConStats.getReceiveCRCErrorCount()));
-        builder.setReceiveDrops(toBI(ndConStats.getReceiveDropCount()));
-        builder.setReceiveErrors(toBI(ndConStats.getReceiveErrorCount()));
-        builder.setReceiveFrameError(toBI(ndConStats.getReceiveFrameErrorCount()));
-        builder.setReceiveOverRunError(toBI(ndConStats.getReceiveOverRunErrorCount()));
-        builder.setTransmitDrops(toBI(ndConStats.getTransmitDropCount()));
-        builder.setTransmitErrors(toBI(ndConStats.getTransmitErrorCount()));
-
-        return builder.build();
+    private List<NodeConnectorStatisticsAndPortNumberMap> toOdNodeConnectorStatistics(
+            List<NodeConnectorStatistics> ncStatsList) {
+        List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsList = new ArrayList<NodeConnectorStatisticsAndPortNumberMap>();
+        for(NodeConnectorStatistics ofNodeConnectorStatistics : ncStatsList){
+            NodeConnectorStatisticsAndPortNumberMapBuilder nodeConnectorStatisticsAndPortNumberMapBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
+            
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setBytes(extractBytes(ofNodeConnectorStatistics));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setCollisionCount(toBI(ofNodeConnectorStatistics.getCollisionCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setDuration(null);
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setPackets(extractPackets(ofNodeConnectorStatistics));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveCrcError(toBI(ofNodeConnectorStatistics.getReceiveCRCErrorCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveDrops(toBI(ofNodeConnectorStatistics.getReceiveDropCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveErrors(toBI(ofNodeConnectorStatistics.getReceiveErrorCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveFrameError(toBI(ofNodeConnectorStatistics.getReceiveFrameErrorCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveOverRunError(toBI(ofNodeConnectorStatistics.getReceiveOverRunErrorCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setTransmitDrops(toBI(ofNodeConnectorStatistics.getTransmitDropCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setTransmitErrors(toBI(ofNodeConnectorStatistics.getTransmitErrorCount()));
+            nodeConnectorStatisticsList.add(nodeConnectorStatisticsAndPortNumberMapBuilder.build());
+        }
+        
+        return nodeConnectorStatisticsList;
     }
 
     private BigInteger toBI(long num) {
@@ -292,49 +292,4 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
         return builder.build();
     }
 
-    private GetFlowTableStatisticsOutput toOdTableStatistics(NodeTableStatistics nodeTable) {
-        GetFlowTableStatisticsOutputBuilder builder = new GetFlowTableStatisticsOutputBuilder();
-
-        builder.setActive(toCounter64(nodeTable.getActiveCount()));
-        builder.setLookup(toCounter64(nodeTable.getLookupCount()));
-        builder.setMatched(toCounter64(nodeTable.getMatchedCount()));
-
-        return builder.build();
-    }
-
-    @Override
-    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
-            GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
-            GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
-            GetAllFlowStatisticsFromFlowTableInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
-            GetAllFlowsStatisticsFromAllFlowTablesInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
-            GetFlowStatisticsFromFlowTableInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
 }
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyAdapter.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyAdapter.xtend
new file mode 100644 (file)
index 0000000..bd2590f
--- /dev/null
@@ -0,0 +1,30 @@
+package org.opendaylight.controller.sal.compatibility.topology
+
+import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.sal.topology.IPluginInTopologyService
+import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NetworkTopology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TopologyId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.Topology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.TopologyKey
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
+import static extension org.opendaylight.controller.sal.compatibility.topology.TopologyMapping.*
+
+class TopologyAdapter implements IPluginInTopologyService {
+    
+    @Property
+    DataProviderService dataService;
+    
+    @Property
+    IPluginOutTopologyService topologyPublisher;
+    
+    override sollicitRefresh() {
+        val path = InstanceIdentifier.builder(NetworkTopology).child(Topology,new TopologyKey(new TopologyId("flow:1"))).toInstance;
+        val reader = TypeSafeDataReader.forReader(dataService)
+        val topology = reader.readOperationalData(path)
+        topologyPublisher.edgeUpdate(topology.toADEdgeUpdates(reader))
+    }
+    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyCommitHandler.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyCommitHandler.xtend
new file mode 100644 (file)
index 0000000..7d05ce6
--- /dev/null
@@ -0,0 +1,62 @@
+package org.opendaylight.controller.sal.compatibility.topology
+
+import com.google.common.collect.FluentIterable
+import java.util.concurrent.CopyOnWriteArrayList
+import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.sal.core.UpdateType
+import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
+import org.opendaylight.controller.sal.topology.TopoEdgeUpdate
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NetworkTopology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TopologyId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.Topology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.TopologyKey
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.Link
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import static extension org.opendaylight.controller.sal.compatibility.topology.TopologyMapping.*
+import org.slf4j.LoggerFactory
+
+class TopologyCommitHandler implements DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> {
+    static val LOG = LoggerFactory.getLogger(TopologyCommitHandler);
+    @Property
+    IPluginOutTopologyService topologyPublisher;
+    
+    @Property
+    DataProviderService dataService;
+    
+    new(DataProviderService dataService) {
+        _topologyPublisher = topologyPublisher
+        _dataService = dataService
+    }
+    
+    override requestCommit(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        val msg = new CopyOnWriteArrayList<TopoEdgeUpdate>()
+        try {
+            val reader = TypeSafeDataReader.forReader(dataService)
+            val topologyPath = InstanceIdentifier.builder(NetworkTopology).child(Topology, new TopologyKey(new TopologyId("flow:1"))).toInstance
+            val topology = reader.readOperationalData(topologyPath)
+            val adds = FluentIterable.from(modification.createdOperationalData.entrySet)
+                .filter[value instanceof Link]
+                .transform[(value as Link).toAdEdge(topology).toTopoEdgeUpdate(UpdateType.ADDED,reader)]
+                .toList
+            val updates = FluentIterable.from(modification.updatedOperationalData.entrySet)
+                .filter[!modification.createdOperationalData.containsKey(key) && (value instanceof Link)]
+                .transform[(value as Link).toAdEdge(topology).toTopoEdgeUpdate(UpdateType.ADDED,reader)] // Evidently the ADSAL does not expect edge 'CHANGED"
+                .toList
+            val removes = FluentIterable.from(modification.removedOperationalData)
+                .transform[reader.readOperationalData(it as InstanceIdentifier<DataObject>)]
+                .filter[it instanceof Link]
+                .transform[(it as Link).toAdEdge(topology).toTopoEdgeUpdate(UpdateType.REMOVED,reader)]
+                .toList
+            msg.addAll(adds)
+            msg.addAll(updates)
+            msg.addAll(removes)
+         } catch (Exception e) {
+            LOG.error("Exception caught",e)
+         }
+        return new TopologyTransaction(modification,topologyPublisher,dataService,msg)
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyMapping.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyMapping.xtend
new file mode 100644 (file)
index 0000000..62983cc
--- /dev/null
@@ -0,0 +1,71 @@
+package org.opendaylight.controller.sal.compatibility.topology
+
+import com.google.common.collect.FluentIterable
+import java.util.Collections
+import java.util.List
+import java.util.concurrent.CopyOnWriteArrayList
+import org.opendaylight.controller.sal.core.ConstructionException
+import org.opendaylight.controller.sal.core.Edge
+import org.opendaylight.controller.sal.core.Node
+import org.opendaylight.controller.sal.core.NodeConnector
+import org.opendaylight.controller.sal.core.UpdateType
+import org.opendaylight.controller.sal.topology.TopoEdgeUpdate
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NodeId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TpId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.Topology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.Link
+
+import static com.google.common.base.Preconditions.*
+import static extension org.opendaylight.controller.sal.compatibility.NodeMapping.*
+import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector
+
+class TopologyMapping {
+    
+    private new() {
+        throw new UnsupportedOperationException("Utility class. Instantiation is not allowed.");
+    }
+    
+    public static def toADEdgeUpdates(Topology topology,TypeSafeDataReader reader) {
+        val List<TopoEdgeUpdate> result = new CopyOnWriteArrayList<TopoEdgeUpdate>()
+        return FluentIterable.from(topology.link).transform[toAdEdge(topology).toTopoEdgeUpdate(reader)].copyInto(result)
+    }
+    
+    public static def toAdEdge(Link link,Topology topology) {
+        val adSrc = link.source.sourceTp.toADNodeConnector(link.source.sourceNode)
+        val adDst = link.destination.destTp.toADNodeConnector(link.destination.destNode)
+        return new Edge(adSrc,adDst); 
+    }
+    
+    public static def toTopoEdgeUpdate(Edge e,TypeSafeDataReader reader) {
+        return toTopoEdgeUpdate(e,UpdateType.ADDED,reader)
+    }
+    
+    public static def toTopoEdgeUpdate(Edge e,UpdateType type,TypeSafeDataReader reader) {
+        return new TopoEdgeUpdate(e,e.toAdEdgeProperties(reader),type)
+    }
+    
+    public static def toAdEdgeProperties(Edge e,TypeSafeDataReader reader) {
+        val nc = reader.readOperationalData(e.tailNodeConnector.toNodeConnectorRef.value as InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector>)
+        return nc.toADNodeConnectorProperties     
+    }
+    
+    public static def toADNodeId(NodeId nodeId) {
+        checkNotNull(nodeId);
+        return nodeId.value
+    }
+    public static def toADNodeConnector(TpId source,NodeId nodeId) throws ConstructionException {
+        checkNotNull(source);
+        return new NodeConnector(MD_SAL_TYPE,source.toADNodeConnectorId,nodeId.toADNode)
+    }
+    
+    public static def toADNodeConnectorId(TpId nodeConnectorId) {
+        return nodeConnectorId.value
+    }
+    
+    public static def toADNode(NodeId nodeId) {
+        checkNotNull(nodeId);
+        return new Node(MD_SAL_TYPE,nodeId.toADNodeId);       
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyProvider.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyProvider.xtend
new file mode 100644 (file)
index 0000000..1fde282
--- /dev/null
@@ -0,0 +1,48 @@
+package org.opendaylight.controller.sal.compatibility.topology
+
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NetworkTopology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TopologyId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.Topology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.TopologyKey
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yangtools.concepts.Registration
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.Link
+import org.slf4j.LoggerFactory
+
+class TopologyProvider implements AutoCloseable{
+    static val LOG = LoggerFactory.getLogger(TopologyProvider);
+    TopologyCommitHandler commitHandler
+    
+    @Property
+    IPluginOutTopologyService topologyPublisher;
+    
+    @Property
+    DataProviderService dataService;
+    
+    Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>,DataObject>> commitHandlerRegistration;
+    
+    def void start() {
+        commitHandler = new TopologyCommitHandler(dataService)
+        commitHandler.setTopologyPublisher(topologyPublisher)
+        val InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder(NetworkTopology)
+            .child(Topology,new TopologyKey(new TopologyId("flow:1")))
+            .child(Link)
+            .toInstance();
+        commitHandlerRegistration = dataService.registerCommitHandler(path,commitHandler);
+        LOG.info("TopologyProvider started")
+    }
+    
+    override close() throws Exception {
+        commitHandlerRegistration.close
+    }
+    
+    def setTopologyPublisher(IPluginOutTopologyService topologyPublisher) {
+        _topologyPublisher = topologyPublisher;
+        commitHandler.setTopologyPublisher(topologyPublisher);
+    }
+    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyTransaction.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyTransaction.xtend
new file mode 100644 (file)
index 0000000..33927ff
--- /dev/null
@@ -0,0 +1,66 @@
+package org.opendaylight.controller.sal.compatibility.topology
+
+import java.util.Collections
+import java.util.List
+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.binding.api.data.DataProviderService
+import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
+import org.opendaylight.controller.sal.topology.TopoEdgeUpdate
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yangtools.yang.common.RpcResult
+import org.slf4j.LoggerFactory
+
+class TopologyTransaction implements DataCommitTransaction<InstanceIdentifier<?extends DataObject>, DataObject> {
+    static val LOG = LoggerFactory.getLogger(TopologyTransaction);
+    @Property
+    val DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification;
+    
+    @Property
+    IPluginOutTopologyService topologyPublisher;
+    
+    @Property
+    DataProviderService dataService;
+    @Property
+    List<TopoEdgeUpdate> edgeUpdates;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,IPluginOutTopologyService topologyPublisher,
+        DataProviderService dataService,List<TopoEdgeUpdate> edgeUpdates) {
+        _modification = modification;
+        _topologyPublisher = topologyPublisher
+        _dataService = dataService
+        _edgeUpdates = edgeUpdates
+    }
+    override finish() throws IllegalStateException {
+        
+        if(topologyPublisher != null && _edgeUpdates != null && !edgeUpdates.empty) {
+            topologyPublisher.edgeUpdate(edgeUpdates)
+        }
+         
+         return new RpcResultTo()
+    }
+    
+    override getModification() {
+        return _modification;
+    }
+    
+    override rollback() throws IllegalStateException {
+        // NOOP
+    }
+}
+class RpcResultTo implements RpcResult<Void> {
+    
+    override getErrors() {
+        return Collections.emptySet
+    }
+    
+    override getResult() {
+        return null;
+    }
+    
+    override isSuccessful() {
+        return true;
+    }
+    
+}
\ No newline at end of file
index 5203d3c..6fcadea 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 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.flow.types.rev131026.FlowRef
 
 class FlowTransaction extends AbstractTransaction {
     
@@ -32,6 +33,7 @@ class FlowTransaction extends AbstractTransaction {
             val tableInstanceId = instanceId.firstIdentifierOf(Table);
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new RemoveFlowInputBuilder(flow);
+            builder.setFlowRef(new FlowRef(instanceId));
             builder.setNode(new NodeRef(nodeInstanceId));
             builder.setFlowTable(new FlowTableRef(tableInstanceId));
             _salFlowService.removeFlow(builder.build());            
@@ -45,6 +47,7 @@ class FlowTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new UpdateFlowInputBuilder();
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setFlowRef(new FlowRef(instanceId));
             val ufb = new UpdatedFlowBuilder(updatedFlow);
             builder.setUpdatedFlow((ufb.build()));
             val ofb = new OriginalFlowBuilder(originalFlow);
@@ -61,6 +64,7 @@ class FlowTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new AddFlowInputBuilder(flow);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setFlowRef(new FlowRef(instanceId));
             builder.setFlowTable(new FlowTableRef(tableInstanceId));
             _salFlowService.addFlow(builder.build());            
         }
index 54382ea..d68ffa0 100644 (file)
@@ -2,26 +2,18 @@ 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.group.service.rev130918.AddGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+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.OriginalGroupBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group
 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 {
     
@@ -39,6 +31,7 @@ class GroupTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new RemoveGroupInputBuilder(group);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setGroupRef(new GroupRef(instanceId));
             _groupService.removeGroup(builder.build());            
         }
     }
@@ -50,6 +43,7 @@ class GroupTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new UpdateGroupInputBuilder();
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setGroupRef(new GroupRef(instanceId));
             val ufb = new UpdatedGroupBuilder(updatedGroup);
             builder.setUpdatedGroup((ufb.build()));
             val ofb = new OriginalGroupBuilder(originalGroup);
@@ -65,6 +59,7 @@ class GroupTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new AddGroupInputBuilder(group);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setGroupRef(new GroupRef(instanceId));
             _groupService.addGroup(builder.build());            
         }
     }
index 3ed1f40..d64f251 100644 (file)
@@ -13,6 +13,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.met
 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
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef
 
 class MeterTransaction extends AbstractTransaction {
     
@@ -30,6 +31,7 @@ class MeterTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new RemoveMeterInputBuilder(meter);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setMeterRef(new MeterRef(instanceId));
             _salMeterService.removeMeter(builder.build());            
         }
     }
@@ -41,6 +43,7 @@ class MeterTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new UpdateMeterInputBuilder();
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setMeterRef(new MeterRef(instanceId));
             val ufb = new UpdatedMeterBuilder(updatedMeter);
             builder.setUpdatedMeter((ufb.build()));
             val ofb = new OriginalMeterBuilder(originalMeter);
@@ -56,6 +59,7 @@ class MeterTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new AddMeterInputBuilder(meter);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setMeterRef(new MeterRef(instanceId));
             _salMeterService.addMeter(builder.build());            
         }
     }
index 2b023a7..1a66b3b 100644 (file)
@@ -76,7 +76,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
 
         // Check path
         val it = manager.startChange()
-        removeRuntimeData(ref.value as InstanceIdentifier<? extends DataObject>);
+        removeOperationalData(ref.value as InstanceIdentifier<? extends DataObject>);
         commit()
     }
 
@@ -93,7 +93,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
             data.addAugmentation(FlowCapableNodeConnector, augment)
         }
 
-        putRuntimeData(ref.value as InstanceIdentifier<NodeConnector>, data.build());
+        putOperationalData(ref.value as InstanceIdentifier<NodeConnector>, data.build());
         commit()
     }
 
@@ -101,7 +101,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
         val ref = node.nodeRef;
         val it = manager.startChange()
 
-        removeRuntimeData(ref.value as InstanceIdentifier<? extends DataObject>);
+        removeOperationalData(ref.value as InstanceIdentifier<? extends DataObject>);
         commit()
     }
 
@@ -117,7 +117,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
             data.addAugmentation(FlowCapableNode, augment)
         }
 
-        putRuntimeData(ref.value as InstanceIdentifier<Node>, data.build())
+        putOperationalData(ref.value as InstanceIdentifier<Node>, data.build())
         commit()
     }
 }
index 13ffa3f..1c21eff 100644 (file)
             <artifactId>opendaylight-l2-types</artifactId>
             <version>2013.08.27.0</version>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>model-inventory</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
     <packaging>bundle</packaging>
 </project>
index 8c874e2..4442fbb 100644 (file)
@@ -84,6 +84,10 @@ module opendaylight-group-types {
        description "Check chaining for loops and delete";
     }
     
+    typedef group-ref {
+        type instance-identifier;
+    }
+    
     grouping group {
         
         leaf group-type {
@@ -102,10 +106,6 @@ module opendaylight-group-types {
             type string; 
         }
         
-        leaf install {
-            type boolean; 
-        } 
-        
         leaf barrier {
             type boolean; 
         }       
index 1ed1b68..31736d2 100644 (file)
@@ -5,6 +5,7 @@ module opendaylight-match-types {
     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-inventory {prefix inv;revision-date "2013-08-19";}
 
     revision "2013-10-26" {
         description "Initial revision of macth types";
@@ -270,11 +271,11 @@ module opendaylight-match-types {
     
     grouping match {
         leaf in-port {
-            type uint32;
+            type inv:node-connector-id;
         }
         
         leaf in-phy-port {
-            type uint32;
+            type inv:node-connector-id;
         }
         
         container "metadata" {
index b380af2..d84b2f0 100644 (file)
@@ -112,6 +112,10 @@ module opendaylight-meter-types {
         }
     }
     
+    typedef meter-ref {
+        type instance-identifier;
+    }
+    
     grouping meter {
         
         leaf flags {
@@ -120,11 +124,12 @@ module opendaylight-meter-types {
         
         leaf meter-id {
             type meter-id;
-        }
+        }       
         
-        leaf install {
+        leaf barrier {
             type boolean; 
         }
+        
         leaf meter-name {
             type string;
         }
index 2bcd405..a0beb2a 100644 (file)
@@ -12,6 +12,10 @@ module opendaylight-flow-types {
         description "Initial revision of flow service";
     }
     
+    typedef flow-ref {
+        type instance-identifier;
+    }
+    
     typedef output-port-values {
         type enumeration {
             enum MAX {
index bc05894..2554fff 100644 (file)
@@ -27,11 +27,15 @@ module opendaylight-port-types {
         }
     }
     
-    typedef port-state {
-        type enumeration {
-            enum link-down;
-            enum blocked;
-            enum live;
+    grouping port-state {
+        leaf link-down {
+            type boolean;
+        }
+        leaf blocked {
+            type boolean;
+        }   
+        leaf live {
+            type boolean;
         }
     }
     
@@ -103,9 +107,9 @@ module opendaylight-port-types {
             description "Human readable name of the port";                    
         }
         
-        leaf state {
-            type port-state;
-            description "Bit map of OFPPS-* flags";            
+        container state {
+            uses port-state;
+            description "Description of state of port";            
         }
         
         leaf current-feature {
index 483c0c9..1c675f0 100644 (file)
@@ -3,6 +3,7 @@ module flow-capable-transaction {
     prefix type;
 
     import opendaylight-inventory {prefix inv; revision-date "2013-08-19";}
+    import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
     import yang-ext {prefix ext; revision-date "2013-07-09";}
     
     revision "2013-11-03" {
@@ -12,6 +13,12 @@ module flow-capable-transaction {
     typedef transaction-id {
        type uint64;
     }
+    // This refers to MD-SAL transaction reference.
+    grouping transaction-metadata {
+        leaf transaction-uri {
+            type inet:uri;
+        }
+    }
     
     grouping transaction-aware {
         leaf transaction-id {
index 07678f5..5c68a13 100644 (file)
@@ -51,8 +51,11 @@ module sal-flow {
 
     rpc add-flow {
         input {
-            uses node-flow;
-            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            leaf flow-ref {
+                type types:flow-ref;
+            }
+            uses node-flow;            
         }
         output {
             uses tr:transaction-aware;
@@ -61,8 +64,11 @@ module sal-flow {
 
     rpc remove-flow {
         input {
-            uses node-flow;
-            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            leaf flow-ref {
+                type types:flow-ref;
+            }
+            uses node-flow;            
         }
         output {
             uses tr:transaction-aware;
@@ -71,8 +77,11 @@ module sal-flow {
 
     rpc update-flow {
         input {
-            uses flow-update;
-            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            leaf flow-ref {
+                type types:flow-ref;
+            }
+            uses flow-update;           
         }
         output {
             uses tr:transaction-aware;
@@ -80,15 +89,30 @@ module sal-flow {
     }
 
     notification flow-added {
+        uses tr:transaction-metadata;
+        leaf flow-ref {
+            type types:flow-ref;
+        }
         uses node-flow;
+        uses tr:transaction-aware;
     }
 
     notification flow-updated {
+        uses tr:transaction-metadata;
+        leaf flow-ref {
+            type types:flow-ref;
+        }
         uses node-flow;
+        uses tr:transaction-aware;        
     }
 
     notification flow-removed {
+        uses tr:transaction-metadata;
+        leaf flow-ref {
+            type types:flow-ref;
+        }
         uses node-flow;
+        uses tr:transaction-aware;
     }
     
     notification switch-flow-removed {
@@ -98,6 +122,7 @@ module sal-flow {
     notification node-error-notification {
         uses error:error-message;
         uses tr:transaction-aware;
+        uses tr:transaction-metadata;
     }
     
     notification node-experimenter-error-notification {
index 9106bca..7eeb0ac 100644 (file)
@@ -31,8 +31,11 @@ module sal-group {
 
     rpc add-group {
         input {
-            uses node-group;
-            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            leaf group-ref {
+                type group-type:group-ref;
+            }
+            uses node-group;            
         }
         output {
             uses tr:transaction-aware;
@@ -41,8 +44,11 @@ module sal-group {
 
     rpc remove-group {
         input {
-            uses node-group;
-            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            leaf group-ref {
+                type group-type:group-ref;
+            }
+            uses node-group;            
         }
         output {
             uses tr:transaction-aware;
@@ -51,8 +57,11 @@ module sal-group {
 
     rpc update-group {
         input {
-            uses group-update;
-            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            leaf group-ref {
+                type group-type:group-ref;
+            }
+            uses group-update;            
         }
         output {
             uses tr:transaction-aware;
@@ -60,14 +69,29 @@ module sal-group {
     } 
 
     notification group-added {
+        uses tr:transaction-metadata;
+        leaf group-ref {
+            type group-type:group-ref;
+        }
         uses node-group;
+        uses tr:transaction-aware;
     }
 
     notification group-updated {
+        uses tr:transaction-metadata;
+        leaf group-ref {
+            type group-type:group-ref;
+        }
         uses node-group;
+        uses tr:transaction-aware;
     }
 
     notification group-removed {
+        uses tr:transaction-metadata;
+        leaf group-ref {
+            type group-type:group-ref;
+        }
         uses node-group;
+        uses tr:transaction-aware;
     }    
 }
\ No newline at end of file
index c187181..ecdef41 100644 (file)
@@ -31,8 +31,11 @@ module sal-meter {
 
     rpc add-meter {
         input {
-            uses node-meter;
-            uses tr:transaction-aware;            
+            uses tr:transaction-metadata;            
+            leaf meter-ref {
+                type meter-type:meter-ref;
+            }
+            uses node-meter;            
         }
         output {
             uses tr:transaction-aware;
@@ -41,8 +44,12 @@ module sal-meter {
 
     rpc remove-meter {
         input {
-            uses node-meter;
-            uses tr:transaction-aware;            
+            uses tr:transaction-metadata;            
+            leaf meter-ref {
+                type meter-type:meter-ref;
+            }
+            
+            uses node-meter;                       
         }
         output {
             uses tr:transaction-aware;
@@ -51,8 +58,12 @@ module sal-meter {
 
     rpc update-meter {
         input {
-            uses meter-update;
-            uses tr:transaction-aware;            
+            uses tr:transaction-metadata;            
+            leaf meter-ref {
+                type meter-type:meter-ref;
+            }
+            
+            uses meter-update;                       
         }
         output {
             uses tr:transaction-aware;
@@ -60,14 +71,29 @@ module sal-meter {
     }
         
     notification meter-added {
+        uses tr:transaction-metadata;
+        leaf meter-ref {
+            type meter-type:meter-ref;
+        }
         uses node-meter;
+        uses tr:transaction-aware;
     }
 
     notification meter-updated {
+        uses tr:transaction-metadata;
+        leaf meter-ref {
+            type meter-type:meter-ref;
+        }
         uses node-meter;
+        uses tr:transaction-aware;
     }
 
     notification meter-removed {
+        uses tr:transaction-metadata;
+        leaf meter-ref {
+            type meter-type:meter-ref;
+        }
         uses node-meter;
+        uses tr:transaction-aware;
     }
 }
\ No newline at end of file
index d49675a..6795e6f 100644 (file)
@@ -43,9 +43,14 @@ module sal-port {
         output {
             uses port-type:flow-capable-port;
         }
-    }  
+    }
+    
+    notification port-updated {
+        uses port-update;
+        uses tr:transaction-aware;
+    }
     
     notification port-removed {
-        uses node-port;
+        uses node-port;       
     }
 }
\ No newline at end of file
index 3bd37bc..7bbcca3 100644 (file)
@@ -115,7 +115,7 @@ module opendaylight-flow-statistics {
         }
        }    
        
-    // RPC calls to fetch flow statistics
+    // RPC calls to fetch aggregate flow statistics
     rpc get-aggregate-flow-statistics-from-flow-table-for-all-flows {
        description "Fetch aggregate statistics for all the flows present in the specific flow table of the switch"; 
         input {
@@ -150,76 +150,4 @@ module opendaylight-flow-statistics {
                uses stat-types:aggregate-flow-statistics;
                uses tr:transaction-aware;
     }
-       
-       //Keeping flow statistics RPC call for backward compatibility for sal-compatibility layer --START
-       rpc get-flow-statistics {
-        input {
-            uses inv:node-context-ref;
-            uses flow-types:flow;
-        }
-        output {
-            uses flow-types:flow-statistics;
-        }
-    }
-
-    rpc get-all-flow-statistics {
-        input {
-            uses inv:node-context-ref;
-        }
-        output {
-            list flow-statistics {
-                uses flow-types:flow-statistics;
-            }
-        }
-    }
-
-    notification flow-statistics-updated {
-        uses flow-types:flow-statistics;
-    }
-       
-       //Keeping flow statistics RPC call for backward compatibility for sal-compatibility layer --END
-       
-       //RPC call to fetch node connector statistics
-    rpc get-node-connector-statistics {
-        input {
-            uses inv:node-context-ref;
-            leaf node-connector {
-                type inv:node-connector-ref;
-            }
-        }
-        output {
-            uses stat-types:node-connector-statistics;
-        }
-    }
-
-    rpc get-all-node-connector-statistics {
-        input {
-            uses inv:node-context-ref;
-        }
-        output {
-            list node-connector-statistics {
-                uses stat-types:node-connector-statistics;
-            }
-        }
-    }
-
-    rpc get-flow-table-statistics {
-        input {
-            uses inv:node-context-ref;
-        }
-        output {
-            uses flow-types:flow-table-statistics;
-        }
-    }
-
-    notification flow-table-statistics-updated {
-        leaf flow-table {
-            type flow:flow-table-ref;
-        }
-        uses flow-types:flow-table-statistics;
-    }
-
-    notification node-connector-statistics-updated {
-        uses stat-types:node-connector-statistics;
-    }
 }
index 0cb6a60..787a4e6 100644 (file)
@@ -30,19 +30,19 @@ module opendaylight-port-statistics {
        }    
        
     // RPC calls
-    rpc get-all-ports-statistics {
-       description "Get statistics for all the ports from the node";
+    rpc get-all-node-connectors-statistics {
+       description "Get statistics for all node connectors from the node";
         input {
             uses inv:node-context-ref;
         }
         output {
-            uses stat-types:node-connector-statistics;
+                       uses node-connector-statistics-and-port-number-map;
             uses tr:transaction-aware;
         }
     }
     
-    rpc get-port-statistics {
-       description "Get statistics for given port from the node";
+    rpc get-node-connector-statistics {
+       description "Get statistics for given node connector from the node";
        input {
                uses inv:node-context-ref;
                leaf node-connector-id {
@@ -55,9 +55,9 @@ module opendaylight-port-statistics {
        }
     }
     
-    //Notification for port statistics update
+    //Notification for node connector statistics update
        grouping node-connector-statistics-and-port-number-map {
-               description "List of flow and statistics map";
+               description "List of map - node connectors and their statistics";
                list node-connector-statistics-and-port-number-map {
                        key "node-connector-id";
                        leaf node-connector-id {
@@ -67,7 +67,7 @@ module opendaylight-port-statistics {
                }
        }
 
-       notification port-statistics-update {
+       notification node-connector-statistics-update {
         leaf moreReplies {
             type boolean;
         }
index 33c03ba..ceeef45 100644 (file)
@@ -21,12 +21,14 @@ module opendaylight-topology-inventory {
 
     augment "/topo:network-topology/topo:topology/topo:node" {
         ext:augment-identifier "inventory-node";
-        uses inv:node-context-ref;
+        leaf inventory-node-ref {
+            type inv:node-ref;
+        }
     }
 
     augment "/topo:network-topology/topo:topology/topo:node/topo:termination-point" {
         ext:augment-identifier "inventory-node-connector";
-        leaf node-connector {
+        leaf inventory-node-connector-ref {
             ext:context-reference "inv:node-connector-context";
             type inv:node-connector-ref;
         }
index c5f1ddd..571e9d8 100644 (file)
@@ -19,7 +19,7 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <bundle.plugin.version>2.3.7</bundle.plugin.version>
+        <bundle.plugin.version>2.4.0</bundle.plugin.version>
     </properties>
 
     <modules>
@@ -40,7 +40,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
-                        <Import-Package>*,org.opendaylight.yangtools.yang.binding.annotations</Import-Package>
+                        <Import-Package>org.opendaylight.yangtools.yang.binding.annotations, *</Import-Package>
                     </instructions>
                 </configuration>
             </plugin>
                                     <codeGeneratorClass>org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl</codeGeneratorClass>
                                     <outputBaseDir>target/site/models</outputBaseDir>
          &nbs