--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <artifactId>model-parent</artifactId>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>model-flow-statistics</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>model-inventory</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>model-flow</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <packaging>bundle</packaging>
+</project>
\ No newline at end of file
--- /dev/null
+module opendaylight-flow-statistics {
+ namespace "urn:opendaylight:flow:statistics";
+ prefix flowstat;
+
+ import yang-ext {prefix ext;}
+ import ietf-inet-types {prefix inet;}
+ import ietf-yang-types {prefix yang;}
+ import opendaylight-flow {prefix flow;}
+ import opendaylight-inventory {prefix inv;}
+
+ revision "2013-08-19" {
+ description "Initial revision of flow service";
+ }
+
+ augment "/flow:flows/flow:flow" {
+ ext:augment-identifier "flow-statistics";
+
+ leaf packet-count {
+ type uint64;
+ }
+
+ leaf byte-count {
+ type uint64;
+ }
+
+ container duration {
+ leaf second {
+ type uint64;
+ }
+ leaf nanosecond {
+ type uint64;
+ }
+ }
+ }
+
+ augment "/inv:nodes/inv:node/inv:node-connector" {
+ ext:augment-identifier "node-connector-statistics";
+
+ container packets {
+ leaf received {
+ type uint64;
+ }
+ leaf transmitted {
+ type uint64;
+ }
+ }
+ container bytes {
+ leaf received {
+ type uint64;
+ }
+ leaf transmitted {
+ type uint64;
+ }
+ }
+ leaf receive-drops {
+ type uint64;
+ }
+ leaf transmit-drops {
+ type uint64;
+ }
+ leaf receive-errors {
+ type uint64;
+ }
+ leaf transmit-errors {
+ type uint64;
+ }
+ leaf receive-frame-error {
+ type uint64;
+ }
+ leaf receive-over-run-error {
+ type uint64;
+ }
+ leaf receive-crc-error {
+ type uint64;
+ }
+ leaf collision-count {
+ type uint64;
+ }
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <artifactId>model-parent</artifactId>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>model-flow</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>model-inventory</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <packaging>bundle</packaging>
+</project>
\ No newline at end of file
--- /dev/null
+module opendaylight-flow {
+ namespace "urn:opendaylight:flow:service";
+ prefix flow;
+
+ import yang-ext {prefix ext;}
+ import ietf-inet-types {prefix inet;}
+ import ietf-yang-types {prefix yang;}
+ import opendaylight-inventory {prefix inv;}
+
+ revision "2013-08-19" {
+ description "Initial revision of flow service";
+ }
+
+ /** Base structure **/
+ container flows {
+ list flow {
+ leaf node {
+ type inv:node-id;
+ }
+ container match {
+ // Match is empty
+ leaf input-node-connector {
+ type inv:node-connector-id; //
+ }
+ }
+ list action {
+ key id;
+ leaf id {
+ type string;
+ }
+ choice action {
+
+ }
+ }
+ }
+ }
+
+ /** Matches **/
+ augment "/flows/flow/match" {
+ ext:augment-identifier "ethernet-match";
+ container ethernet-source {
+ description "Ethernet source address.";
+ leaf address {
+ type yang:mac-address;
+ }
+ leaf mask {
+ type binary;
+ }
+ }
+ container ethernet-destination {
+ description "Ethernet destination address.";
+ leaf address {
+ type yang:mac-address;
+ }
+ }
+ container ethernet-type {
+ description "Ethernet frame type.";
+ leaf type {
+ type uint16; // Needs to define that as general model
+ }
+ leaf mask {
+ type binary;
+ }
+ }
+ }
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "vlan-match";
+
+ container vlan-id {
+ description "VLAN id.";
+ leaf vlan-id {
+ type uint16; // TODO: Define proper vlan id type.
+ }
+ leaf mask {
+ type binary;
+ }
+ }
+ leaf vlan-pcp {
+ description "VLAN priority.";
+ type uint8; // TODO: Define PCP type
+ }
+
+
+ }
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "ip-match";
+
+ leaf ip-protocol {
+ description "IP protocol.";
+ type uint8; // TODO define IP protocol number
+ }
+
+ leaf ip-dscp {
+ description "IP DSCP (6 bits in ToS field).";
+ type inet:dscp; // TODO: Define DSCP type
+ }
+ leaf ip-ecn {
+ description "IP ECN (2 bits in ToS field).";
+ type uint8; // TODO define ECN
+ }
+ }
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "ipv4-match";
+ leaf ipv4-source {
+ description "IPv4 source address.";
+ type inet:ipv4-prefix;
+ }
+ leaf ipv4-destination {
+ description "IPv4 destination address.";
+ type inet:ipv4-prefix;
+ }
+ }
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "ipv6-match";
+ leaf ipv6-source {
+ description "IPv6 source address.";
+ type inet:ipv6-prefix;
+ }
+ leaf ipv6-destination {
+ description "IPv6 destination address.";
+ type inet:ipv6-prefix;
+ }
+ }
+
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "udp-match";
+
+ leaf udp-source-port {
+ description "UDP source port.";
+ type inet:port-number;
+ }
+ leaf udp-destination-port {
+ description "UDP destination port.";
+ type inet:port-number;
+ }
+ }
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "tcp-match";
+ leaf tcp-source-port {
+ description "TCP source port.";
+ type inet:port-number;
+ }
+ leaf tcp-destination-port {
+ description "TCP destination port.";
+ type inet:port-number;
+ }
+ }
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "sctp-match";
+ leaf sctp-source-port {
+ description "SCTP source port.";
+ type inet:port-number;
+ }
+ leaf sctp-destination-dst {
+ description "SCTP destination port.";
+ type inet:port-number;
+ }
+ }
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "icmpv4-match";
+ leaf icmpv4-type {
+ description "ICMP type.";
+ type uint8; // Define ICMP Type
+ }
+ description "ICMP code.";
+ leaf icmpv4-code {
+ type uint8; // Define ICMP Code
+ }
+ }
+
+ augment "/flows/flow/match" {
+ ext:augment-identifier "arp-match";
+
+ leaf arp-source-transport-address {
+ description "ARP source IPv4 address.";
+ type inet:ipv4-prefix;
+ }
+
+ leaf arp-target-transport-address {
+ description "ARP target IPv4 address.";
+ type inet:ipv4-prefix;
+ }
+ container arp-source-hardware-address {
+ description "ARP source hardware address.";
+ leaf address {
+ type yang:mac-address;
+ }
+ leaf mask {
+ type binary;
+ }
+ }
+ container arp-target-hardware-address {
+ description "ARP target hardware address.";
+ leaf address {
+ type yang:mac-address;
+ }
+ leaf mask {
+ type binary;
+ }
+ }
+ }
+
+ /** Actions **/
+ augment "/flows/flow/action/action" {
+ case output-action {
+ leaf output-node-connector {
+ type string;
+ }
+ }
+
+ case controller-action {
+ leaf max-length {
+ type uint16 {
+ range "0..65294";
+ }
+ }
+ }
+
+ case set-queue-action {
+ leaf queue {
+ type string; // TODO: define queues
+ }
+ }
+
+ case pop-mpls-action {
+ container pop-mpls {
+ leaf ethernet-type {
+ type uint16; // TODO: define ethertype type
+ }
+ }
+ }
+
+ case set-mpls-ttl-action {
+ leaf mpls-ttl {
+ type uint8;
+ }
+ }
+
+ case set-nw-ttl-action {
+ leaf nw-ttl {
+ type uint8;
+ }
+ }
+
+ case push-pbb-action {
+
+ }
+
+ case push-mpls-action {
+
+ }
+
+ case push-vlan-action {
+
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <artifactId>model-parent</artifactId>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>model-inventory</artifactId>
+ <packaging>bundle</packaging>
+</project>
\ No newline at end of file
--- /dev/null
+module opendaylight-inventory {
+ namespace "urn:opendaylight:inventory";
+ prefix flow;
+
+ import yang-ext {prefix ext;}
+ import ietf-inet-types {prefix inet;}
+ import ietf-yang-types {prefix yang;}
+
+
+ revision "2013-08-19" {
+ description "Initial revision of Inventory model";
+ }
+
+ typedef node-id {
+ type inet:uri;
+ }
+
+ typedef node-connector-id {
+ type inet:uri;
+ }
+
+ /** Base structure **/
+ container nodes {
+ list node {
+ key id;
+ leaf id {
+ type node-id;
+ }
+ list node-connector {
+ type node-connector-id;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <artifactId>model-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <yang.version>0.5.7-SNAPSHOT</yang.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.bundle.version>2.4.0</maven.bundle.version>
+ </properties>
+
+ <modules>
+ <module>model-inventory</module>
+ <module>model-flow</module>
+ <module>model-flow-statistics</module>
+ <!-- <module>model-topology-bgp</module> -->
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${yang.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <yangFilesRootDir>src/main/yang</yangFilesRootDir>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>
+ org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
+ </codeGeneratorClass>
+ <outputBaseDir>
+ target/generated-sources/sal
+ </outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>0.5.7-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/generated-sources/sal</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse
+ m2e settings only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.opendaylight.yangtools
+ </groupId>
+ <artifactId>
+ yang-maven-plugin
+ </artifactId>
+ <versionRange>
+ [0.5,)
+ </versionRange>
+ <goals>
+ <goal>
+ generate-sources
+ </goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-binding</artifactId>
+ <version>${yang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ <version>${yang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
+ <version>2010.09.24-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools.model</groupId>
+ <artifactId>ietf-yang-types</artifactId>
+ <version>2010.09.24-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-ext</artifactId>
+ <version>2013.09.07-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
--- /dev/null
+*.yang
\ No newline at end of file
<module>sal-binding-api</module>
<module>sal-binding-broker-impl</module>
<module>samples</module>
+ <module>model</module>
</modules>
<properties>
--- /dev/null
+package org.opendaylight.controller.sal.binding.api;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public abstract class AbstractBindingAwareConsumer implements BindingAwareConsumer,BundleActivator {
+
+ @Override
+ public final void start(BundleContext context) throws Exception {
+ ServiceReference<BindingAwareBroker> brokerRef = context.getServiceReference(BindingAwareBroker.class);
+ BindingAwareBroker broker = context.getService(brokerRef);
+ broker.registerConsumer(this, context);
+ //context.ungetService(brokerRef);
+ }
+
+ @Override
+ public final void stop(BundleContext context) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.sal.binding.api;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public abstract class AbstractBindingAwareProvider implements BindingAwareProvider, BundleActivator {
+
+ @Override
+ public final void start(BundleContext context) throws Exception {
+ ServiceReference<BindingAwareBroker> brokerRef = context.getServiceReference(BindingAwareBroker.class);
+ BindingAwareBroker broker = context.getService(brokerRef);
+ broker.registerProvider(this, context);
+ }
+
+ @Override
+ public final void stop(BundleContext context) throws Exception {
+
+
+ }
+}
package org.opendaylight.controller.sal.binding.api;
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.binding.api.data.DataConsumerService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.osgi.framework.BundleContext;
* {@link NotificationProviderService}
* <li>Functionality and Data model
* <li>Data Store access and modification - see {@link DataBrokerService} and
- * {@link DataConsumerService}
+ * {@link DataProviderService}
* </ul>
*
* The services are exposed via session.
* system.
*
*
- * @see DataConsumerService
+ * @see DataProviderService
*/
public interface DataBrokerService extends BindingAwareService {
* {@link Provider#getProviderFunctionality()}
* <li>passing an instance of implementation and {@link DataStoreIdentifier} of
* rpc as arguments to the
- * {@link DataConsumerService#addCommitHandler(DataStoreIdentifier, DataCommitHandler)}
+ * {@link DataProviderService#addCommitHandler(DataStoreIdentifier, DataCommitHandler)}
* </ul>
*
*
import org.opendaylight.controller.sal.common.DataStoreIdentifier;
-public interface DataConsumerService extends DataBrokerService {
+public interface DataProviderService extends DataBrokerService {
/**
* Adds {@link DataValidator} for specified Data Store
import java.util.Set;
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.DataRoot;
public interface RuntimeDataProvider {
+ Set<DataStoreIdentifier> getSupportedStores();
+
+
Set<Class<? extends DataRoot>> getProvidedDataRoots();
+
+
+ /**
+ * Returns a data from specified Data Store.
+ *
+ * Returns all the data visible to the consumer from specified Data Store.
+ *
+ * @param <T>
+ * Interface generated from YANG module representing root of data
+ * @param store
+ * Identifier of the store, from which will be data retrieved
+ * @return data visible to the consumer
+ */
+ <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType);
+
+ /**
+ * Returns a filtered subset of data from specified Data Store.
+ *
+ * <p>
+ * The filter is modeled as an hierarchy of Java TOs starting with
+ * implementation of {@link DataRoot} representing data root. The semantics
+ * of the filter tree is the same as filter semantics defined in the NETCONF
+ * protocol for rpc operations <code>get</code> and <code>get-config</code>
+ * in Section 6 of RFC6241.
+ *
+ *
+ * @see http://tools.ietf.org/html/rfc6241#section-6
+ * @param <T>
+ * Interface generated from YANG module representing root of data
+ * @param store
+ * Identifier of the store, from which will be data retrieved
+ * @param filter
+ * Data tree filter similar to the NETCONF filter
+ * @return
+ */
+ <T extends DataRoot> T getData(DataStoreIdentifier store, T filter);
}
--- /dev/null
+/xtend-gen
private Map<Class<? extends RpcService>, RpcProxyContext> managedProxies = new HashMap();
private var NotificationBrokerImpl notifyBroker
private var ServiceRegistration<NotificationProviderService> notifyBrokerRegistration
-
+ private var DataBrokerImpl dataBroker
+
@Property
var BundleContext brokerBundleContext
new OsgiProviderContext(providerCtx, this)
}
+ /**
+ * Returns a Managed Direct Proxy for supplied class
+ *
+ * Managed direct proxy is a generated proxy class conforming to the supplied interface
+ * which delegates all calls to the backing delegate.
+ *
+ * Proxy does not do any validation, null pointer checks or modifies data in any way, it
+ * is only use to avoid exposing direct references to backing implementation of service.
+ *
+ * If proxy class does not exist for supplied service class it will be generated automatically.
+ */
def <T extends RpcService> getManagedDirectProxy(Class<T> service) {
var RpcProxyContext existing = null
return proxyCls.toClass(delegate.classLoader)
}
+ /**
+ * Registers RPC Implementation
+ *
+ */
def <T extends RpcService> registerRpcImplementation(Class<T> type, T service, OsgiProviderContext context,
Hashtable<String, String> properties) {
val proxy = getManagedDirectProxy(type)
return new RpcServiceRegistrationImpl<T>(type, service, osgiReg);
}
+ /**
+ * Helper method to return delegate from ManagedDirectedProxy with use of reflection.
+ *
+ * Note: This method uses reflection, but access to delegate field should be
+ * avoided and called only if neccessary.
+ *
+ */
def <T extends RpcService> getDelegate(RpcService proxy) {
val field = proxy.class.getField(DELEGATE_FIELD)
if(field == null) throw new UnsupportedOperationException("Unable to get delegate from proxy");
return field.get(proxy) as T
}
+ /**
+ * Helper method to set delegate to ManagedDirectedProxy with use of reflection.
+ *
+ * Note: This method uses reflection, but setting delegate field should not occur too much
+ * to introduce any significant performance hits.
+ *
+ */
def void setDelegate(RpcService proxy, RpcService delegate) {
val field = proxy.class.getField(DELEGATE_FIELD)
if(field == null) throw new UnsupportedOperationException("Unable to set delegate to proxy");
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
- <modelVersion>4.0.0</modelVersion>\r
- <parent>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>sal-parent</artifactId>\r
- <version>1.0-SNAPSHOT</version>\r
- </parent>\r
- <artifactId>sal-core-api</artifactId>\r
-\r
- <dependencies>\r
- <dependency>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>sal-common</artifactId>\r
- <version>1.0-SNAPSHOT</version>\r
- </dependency>\r
-\r
- <dependency>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>yang-data-api</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>yang-model-api</artifactId>\r
- </dependency>\r
- </dependencies>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>sal-core-api</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-model-api</artifactId>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
import org.opendaylight.controller.sal.core.api.Provider;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.CompositeNodeModification;
+import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
import org.opendaylight.yangtools.yang.data.api.Node;
* was successful, otherwise list of the encountered errors.
*/
RpcResult<CompositeNode> editCandidateData(DataStoreIdentifier store,
- CompositeNodeModification changeSet);
+ MutableCompositeNode changeSet);
/**
* Initiates a two-phase commit of candidate data.
import java.util.Hashtable;
import java.util.concurrent.ExecutionException;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareConsumer;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
import org.opendaylight.controller.sal.binding.api.NotificationListener;
import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.controller.sal.common.GlobalDataStore;
import org.opendaylight.controller.sample.toaster.provider.api.ToastConsumer;
import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev20091120.MakeToastInputBuilder;
import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev20091120.ToastDone;
import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev20091120.ToastType;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev20091120.Toaster;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev20091120.ToasterData;
import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev20091120.ToasterService;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleActivator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class ToastConsumerImpl implements BundleActivator, BindingAwareConsumer, ToastConsumer,
+public class ToastConsumerImpl extends AbstractBindingAwareConsumer implements BundleActivator, BindingAwareConsumer, ToastConsumer,
NotificationListener<ToastDone> {
private static final Logger log = LoggerFactory.getLogger(ToastConsumerImpl.class);
this.session = session;
NotificationService notificationService = session.getSALService(NotificationService.class);
notificationService.addNotificationListener(ToastDone.class, this);
-
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- ServiceReference<BindingAwareBroker> brokerRef = context.getServiceReference(BindingAwareBroker.class);
- BindingAwareBroker broker = context.getService(brokerRef);
- broker.registerConsumer(this, context);
- Dictionary<String, String> properties = new Hashtable<>();
- context.registerService(ToastConsumer.class, this, properties);
+
+
}
- @Override
- public void stop(BundleContext context) throws Exception {
- // TODO Auto-generated method stub
-
+ private void loadToasterData() {
+ // We request data store service implementation
+ DataBrokerService brokerService = session.getSALService(DataBrokerService.class);
+
+ ToasterData data = brokerService.getData(GlobalDataStore.RuntimeInfo, ToasterData.class);
+ Toaster toaster = data.getToaster();
+ log.info("Available toaster is: ", toaster.getToasterManufacturer(),toaster.getToasterModelNumber());
}
@Override
import java.util.Collections;
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev20091120.ToasterService;
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.osgi.framework.BundleActivator;
import org.slf4j.LoggerFactory;
-public class ToasterProvider implements BindingAwareProvider, BundleActivator {
+public class ToasterProvider extends AbstractBindingAwareProvider {
private static final Logger log = LoggerFactory.getLogger(ToasterProvider.class);
private ConsumerContext consumerContext;
public Collection<? extends ProviderFunctionality> getFunctionality() {
return Collections.emptySet();
}
-
- @Override
- public void start(BundleContext context) throws Exception {
- ServiceReference<BindingAwareBroker> brokerRef = context.getServiceReference(BindingAwareBroker.class);
- BindingAwareBroker broker = context.getService(brokerRef);
- broker.registerProvider(this, context);
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
-
-
- }
}