From 68e68b304776fd74c40dd9ce29dab674f4c21dda Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 7 Feb 2015 21:12:07 +0100 Subject: [PATCH] Introduce message bus models This patch introduces the basic mechanics for integrating various event sources across MD-SAL, effectively forming a message bus. Change-Id: I5cbaf9c0975f38c3e3c05ab9862aacf20d2b57c6 Signed-off-by: Robert Gallas Signed-off-by: Robert Varga --- opendaylight/md-sal/messagebus-api/pom.xml | 104 ++++++++++++++ .../src/main/yang/event-aggregator.yang | 131 ++++++++++++++++++ .../src/main/yang/event-source.yang | 85 ++++++++++++ opendaylight/md-sal/pom.xml | 3 + 4 files changed, 323 insertions(+) create mode 100644 opendaylight/md-sal/messagebus-api/pom.xml create mode 100644 opendaylight/md-sal/messagebus-api/src/main/yang/event-aggregator.yang create mode 100644 opendaylight/md-sal/messagebus-api/src/main/yang/event-source.yang diff --git a/opendaylight/md-sal/messagebus-api/pom.xml b/opendaylight/md-sal/messagebus-api/pom.xml new file mode 100644 index 0000000000..542308a96f --- /dev/null +++ b/opendaylight/md-sal/messagebus-api/pom.xml @@ -0,0 +1,104 @@ + + + + 4.0.0 + + + org.opendaylight.controller + sal-parent + 1.2.0-SNAPSHOT + + + message-bus-api + ${project.artifactId} + + bundle + + + + org.opendaylight.controller.model + model-inventory + + + org.opendaylight.yangtools.model + yang-ext + + + org.opendaylight.yangtools.model + ietf-topology + + + + + + + org.opendaylight.yangtools + yang-maven-plugin + + + + generate-sources + + + + + org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl + ${project.build.directory}/generated-sources/sal + + + org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + ${project.build.directory}/generated-sources/config + + urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang + + + + org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl + target/site/models + + + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + add-source + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources/config + + + + + + + org.apache.felix + maven-bundle-plugin + true + + + org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.* + + + + + + diff --git a/opendaylight/md-sal/messagebus-api/src/main/yang/event-aggregator.yang b/opendaylight/md-sal/messagebus-api/src/main/yang/event-aggregator.yang new file mode 100644 index 0000000000..ad7b573396 --- /dev/null +++ b/opendaylight/md-sal/messagebus-api/src/main/yang/event-aggregator.yang @@ -0,0 +1,131 @@ +module event-aggregator { + // FIXME: this module needs to be split up to concepts and API + // as the concepts are shared with the other model in this + // package. + yang-version 1; + namespace "urn:cisco:params:xml:ns:yang:messagebus:eventaggregator"; + prefix "eventaggregator"; + + organization "Cisco Systems, Inc."; + contact "Robert Gallas"; + + description + "Module implementing message but RPC. + + Copyright (c)2014 Cisco Systems, Inc. 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"; + + revision "2014-12-02" { + description "Initial revision"; + } + + typedef pattern { + type string { + length 1..max; + } + + // FIXME: make this a regular expression + description "A match pattern. Specifically this is a wildcard pattern."; + } + + typedef notification-pattern { + type pattern; + description + "Pattern for matching candidate notification types. This pattern is to be + applied against the concatenation of the namespace of the module which + defines that particular notification, followed by a single colon, and + then followed by notification identifier, as supplied in the argument to + the notification statement."; + } + + typedef topic-id { + type string { + length 1..max; + } + description + "A topic identifier. It uniquely defines a topic as seen by the the user + of this model's RPCs"; + } + + // FIXME: we would really like to share instances here, but that requires some sort + // of sane reference counting. The reason for sharing is the data path part + // of notification delivery -- multiple creators of topics can still share + // a single data path. + rpc create-topic { + description + "Create a new topic. A topic is an aggregation of several notification + types from a set of nodes. Each successful invocation results in a unique + topic being created. The caller is responsible for removing the topic + once it is no longer needed."; + + input { + leaf notification-pattern { + type notification-pattern; + mandatory true; + description + "Pattern matching notification which should be forwarded into this + topic."; + } + + leaf node-id-pattern { + type pattern; + mandatory true; + description + "Pattern for matching candidate event source nodes when looking + for contributors to the topic. The pattern will be applied against + /network-topology/topology/node/node-id"; + } + } + + output { + leaf topic-id { + type topic-id; + mandatory true; + } + } + } + + rpc destroy-topic { + description + "Destroy a topic. No further messages will be delivered to it."; + + input { + leaf topic-id { + type topic-id; + mandatory true; + } + } + } + + notification topic-notification { + description + "Notification of an event occuring on a particular node. This notification + acts as an encapsulation for the event being delivered."; + + leaf topic-id { + type topic-id; + mandatory true; + description + "Topic to which this event is being delivered."; + } + + leaf node-id { + // FIXME: should be topology node ID + type string; + mandatory true; + description + "Node ID of the node which generated the event."; + } + + anyxml payload { + mandatory true; + description + "Encapsulated notification. The format is the XML representation of + a notification according to RFC6020 section 7.14.2."; + } + } +} diff --git a/opendaylight/md-sal/messagebus-api/src/main/yang/event-source.yang b/opendaylight/md-sal/messagebus-api/src/main/yang/event-source.yang new file mode 100644 index 0000000000..5dd416cde6 --- /dev/null +++ b/opendaylight/md-sal/messagebus-api/src/main/yang/event-source.yang @@ -0,0 +1,85 @@ +module event-source { + yang-version 1; + namespace "urn:cisco:params:xml:ns:yang:messagebus:eventsource"; + prefix "eventsource"; + + import event-aggregator { prefix aggr; } + import network-topology { prefix nt; revision-date "2013-10-21"; } + import opendaylight-inventory {prefix inv; revision-date "2013-08-19"; } + import yang-ext {prefix ext; revision-date "2013-07-09"; } + + organization "Cisco Systems, Inc."; + contact "Robert Gallas"; + + description + "Base model for a topology where individual nodes can produce events. + + Module implementing event source topology and encapped notification. + + Copyright (c)2014 Cisco Systems, Inc. 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"; + + revision "2014-12-02" { + description "first revision"; + } + + // FIXME: expand this + typedef join-topic-status { + type enumeration { + enum up; + enum down; + } + description "Object status"; + } + + // FIXME: migrate to topology + typedef node-ref { + type leafref { + path "/inv:nodes/inv:node/inv:id"; + } + } + + grouping topology-event-source-type { + container topology-event-source { + presence "indicates an event source-aware topology"; + } + } + + rpc join-topic { + input { + leaf node { + ext:context-reference "inv:node-context"; + type "instance-identifier"; + } + leaf topic-id { + type aggr:topic-id; + description "in current implementation notification-pattern is defined by topic-id. + By persisting topic definition we could omit notification-pattern"; + } + leaf notification-pattern { + type aggr:notification-pattern; + } + } + + output { + leaf status { + type join-topic-status; + } + } + } + + augment "/nt:network-topology/nt:topology/nt:topology-types" { + uses topology-event-source-type; + } + + augment "/nt:network-topology/nt:topology/nt:node" { + when "../../nt:topology-types/topology-event-source"; + leaf event-source-node { + type node-ref; + } + } +} diff --git a/opendaylight/md-sal/pom.xml b/opendaylight/md-sal/pom.xml index 1743b62180..3151380647 100644 --- a/opendaylight/md-sal/pom.xml +++ b/opendaylight/md-sal/pom.xml @@ -90,6 +90,9 @@ sal-remoterpc-connector + + + messagebus-api -- 2.36.6