Getting FAAS renderer started 06/28706/9
authorKhaldoon Al-zoubi <khalAlzoubi@gmail.com>
Wed, 21 Oct 2015 22:05:13 +0000 (18:05 -0400)
committerKhaldoon Al-zoubi <khalAlzoubi@gmail.com>
Wed, 28 Oct 2015 14:25:28 +0000 (10:25 -0400)
This prepares the code structure for the FAAS renderer so that it can
be integrated with the Fabric As A Service (FAAS) project.
For more info about FAAS, Please see
https://wiki.opendaylight.org/view/FaaS:Main

Change-Id: Ie05739b4a9b68dad9c94d6639b3254a2bf0735a9
Signed-off-by: Khaldoon Al-zoubi <khalAlzoubi@gmail.com>
16 files changed:
artifacts/pom.xml
features/pom.xml
features/src/main/features/features.xml
groupbasedpolicy-faas-config/pom.xml [new file with mode: 0644]
groupbasedpolicy-faas-config/src/main/resources/initial/15-groupbasedpolicy-faas.xml [new file with mode: 0644]
pom.xml
renderers/faas/pom.xml [new file with mode: 0644]
renderers/faas/src/main/java/org/opendaylight/controller/config/yang/config/faas_provider/impl/FaasProviderModule.java [new file with mode: 0644]
renderers/faas/src/main/java/org/opendaylight/controller/config/yang/config/faas_provider/impl/FaasProviderModuleFactory.java [new file with mode: 0644]
renderers/faas/src/main/java/org/opendaylight/groupbasedpolicy/renderer/faas/FaasEndpointManagerListener.java [new file with mode: 0644]
renderers/faas/src/main/java/org/opendaylight/groupbasedpolicy/renderer/faas/FaasRenderer.java [new file with mode: 0644]
renderers/faas/src/main/yang/faas-endpoint.yang [new file with mode: 0644]
renderers/faas/src/main/yang/faas-provider-impl.yang [new file with mode: 0644]
renderers/faas/src/main/yang/faas-provider.yang [new file with mode: 0644]
renderers/faas/src/main/yang/faas.yang [new file with mode: 0644]
renderers/pom.xml

index 717edba64e61a3182f4bd8b34657e0328c9cc29d..03af0723007c0a39bd012f1ecab10068f4f65a35 100644 (file)
         <artifactId>ofoverlay-renderer</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>faas-renderer</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>neutron-mapper</artifactId>
         <type>xml</type>
         <classifier>config</classifier>
       </dependency>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>groupbasedpolicy-faas-config</artifactId>
+        <version>${project.version}</version>
+        <type>xml</type>
+        <classifier>config</classifier>
+      </dependency>
       <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>neutron-mapper-config</artifactId>
index ef10f9a35e748f7d3a18a43815c0127108592727..dc51f878402943bafdbf152b6061e480abc0ba94 100644 (file)
       <groupId>org.opendaylight.groupbasedpolicy</groupId>
       <artifactId>ofoverlay-renderer</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.groupbasedpolicy</groupId>
+      <artifactId>faas-renderer</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.groupbasedpolicy</groupId>
       <artifactId>neutron-mapper</artifactId>
       <type>xml</type>
       <classifier>config</classifier>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.groupbasedpolicy</groupId>
+      <artifactId>groupbasedpolicy-faas-config</artifactId>
+      <type>xml</type>
+      <classifier>config</classifier>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.groupbasedpolicy</groupId>
       <artifactId>neutron-mapper-config</artifactId>
index 364f771bd48094c2846424efe327eede912e0d3e..a8c0c3f0d46ac702aaf5148198850c0d2be1689b 100644 (file)
         <configfile finalname="${config.configfile.directory}/15-groupbasedpolicy-ofoverlay.xml">mvn:org.opendaylight.groupbasedpolicy/groupbasedpolicy-ofoverlay-config/{{VERSION}}/xml/config</configfile>
     </feature>
 
+    <!--
+        The FAAS renderer.
+
+        This renderer maps GBP service model to the common abstraction logical network models
+        of the Fabric As A Service (FAAS). In turns, FAAS maps those abstraction
+        models to the physical networks.
+    -->
+    <feature name='odl-groupbasedpolicy-faas' version='${project.version}' description='OpenDaylight :: groupbasedpolicy :: Fabric As A Service Renderer'>
+        <feature version="${project.version}">odl-groupbasedpolicy-base</feature>
+        <feature version='${openflowplugin.version}'>odl-openflowplugin-nxm-extensions</feature>
+        <bundle>mvn:org.opendaylight.groupbasedpolicy/faas-renderer/{{VERSION}}</bundle>
+        <configfile finalname="${config.configfile.directory}/15-groupbasedpolicy-faas.xml">mvn:org.opendaylight.groupbasedpolicy/groupbasedpolicy-faas-config/{{VERSION}}/xml/config</configfile>
+    </feature>
+
     <!--
          The Neutron provider
     -->
diff --git a/groupbasedpolicy-faas-config/pom.xml b/groupbasedpolicy-faas-config/pom.xml
new file mode 100644 (file)
index 0000000..8ba374d
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (c) 2015 Huawei Technologies 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 -->
+<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.groupbasedpolicy</groupId>
+    <artifactId>commons.groupbasedpolicy</artifactId>
+    <version>0.3.0-SNAPSHOT</version>
+    <relativePath>../commons/parent</relativePath>
+  </parent>
+
+  <artifactId>groupbasedpolicy-faas-config</artifactId>
+  <description>Controller Configuration files for groupbasedpolicy</description>
+  <packaging>jar</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/initial/15-groupbasedpolicy-faas.xml</file>
+                  <type>xml</type>
+                  <classifier>config</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/groupbasedpolicy-faas-config/src/main/resources/initial/15-groupbasedpolicy-faas.xml b/groupbasedpolicy-faas-config/src/main/resources/initial/15-groupbasedpolicy-faas.xml
new file mode 100644 (file)
index 0000000..fd0ffb7
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2015 Huawei Technologies 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
+-->
+<snapshot>
+    <configuration>
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <module>
+                    <type xmlns:faas="urn:opendaylight:params:xml:ns:yang:controller:config:faas-provider:impl">
+                        faas:faas-provider-impl
+                    </type>
+                    <name>faas-provider-impl</name>
+
+                    <rpc-registry>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+                        <name>binding-rpc-broker</name>
+                    </rpc-registry>
+
+                    <data-broker>
+                      <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+                      <name>binding-data-broker</name>
+                    </data-broker>
+
+                    <notification-adapter>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-new-notification-service</type>
+                        <name>binding-notification-adapter</name>
+                    </notification-adapter>
+                </module>
+            </modules>
+        </data>
+
+    </configuration>
+
+    <required-capabilities>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:faas-provider:impl?module=faas-provider-impl&amp;revision=2015-10-09</capability>
+    </required-capabilities>
+
+</snapshot>
diff --git a/pom.xml b/pom.xml
index 1e40da8abb79dfe1585ac86f46720589479de6a0..6a1c8c80c6f7a8baec7915cc12c03eeeab4387b9 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -26,6 +26,7 @@
     <module>groupbasedpolicy</module>
     <module>renderers</module>
     <module>groupbasedpolicy-ofoverlay-config</module>
+    <module>groupbasedpolicy-faas-config</module>
     <module>neutron-mapper</module>
     <module>neutron-mapper-config</module>
     <module>neutron-ovsdb</module>
diff --git a/renderers/faas/pom.xml b/renderers/faas/pom.xml
new file mode 100644 (file)
index 0000000..42efe13
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (c) 2015 Huawei Technologies 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 -->
+<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.groupbasedpolicy</groupId>
+    <artifactId>groupbasedpolicy-renderers</artifactId>
+    <version>0.3.0-SNAPSHOT</version>
+    <relativePath>../</relativePath>
+  </parent>
+
+  <artifactId>faas-renderer</artifactId>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>yang-ext</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.openflowplugin</groupId>
+      <artifactId>openflowplugin-extension-nicira</artifactId>
+    </dependency>
+    <!-- testing dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <!-- project build -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package>
+              org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.faas.rev151009.*
+            </Export-Package>
+          </instructions>
+          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.opendaylight.yangtools</groupId>
+        <artifactId>yang-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/renderers/faas/src/main/java/org/opendaylight/controller/config/yang/config/faas_provider/impl/FaasProviderModule.java b/renderers/faas/src/main/java/org/opendaylight/controller/config/yang/config/faas_provider/impl/FaasProviderModule.java
new file mode 100644 (file)
index 0000000..c18017e
--- /dev/null
@@ -0,0 +1,31 @@
+package org.opendaylight.controller.config.yang.config.faas_provider.impl;
+
+import org.opendaylight.groupbasedpolicy.renderer.faas.FaasRenderer;
+
+public class FaasProviderModule extends
+        org.opendaylight.controller.config.yang.config.faas_provider.impl.AbstractFaasProviderModule {
+
+    public FaasProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public FaasProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            org.opendaylight.controller.config.yang.config.faas_provider.impl.FaasProviderModule oldModule,
+            java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new FaasRenderer(getDataBrokerDependency(), getRpcRegistryDependency(),
+                getNotificationAdapterDependency());
+    }
+
+}
diff --git a/renderers/faas/src/main/java/org/opendaylight/controller/config/yang/config/faas_provider/impl/FaasProviderModuleFactory.java b/renderers/faas/src/main/java/org/opendaylight/controller/config/yang/config/faas_provider/impl/FaasProviderModuleFactory.java
new file mode 100644 (file)
index 0000000..1ad57e6
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Generated file
+ * 
+ * Generated from: yang module name: faas-provider-impl yang module local name: faas-provider-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Fri Oct 09 16:39:53 EDT 2015
+ * 
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.config.faas_provider.impl;
+
+public class FaasProviderModuleFactory extends
+        org.opendaylight.controller.config.yang.config.faas_provider.impl.AbstractFaasProviderModuleFactory {
+
+}
diff --git a/renderers/faas/src/main/java/org/opendaylight/groupbasedpolicy/renderer/faas/FaasEndpointManagerListener.java b/renderers/faas/src/main/java/org/opendaylight/groupbasedpolicy/renderer/faas/FaasEndpointManagerListener.java
new file mode 100644 (file)
index 0000000..0b5999d
--- /dev/null
@@ -0,0 +1,84 @@
+package org.opendaylight.groupbasedpolicy.renderer.faas;
+
+/*
+ * Copyright (c) 2015 Huawei Technologies 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
+ */
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.groupbasedpolicy.util.IidFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.Endpoint;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3Prefix;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FaasEndpointManagerListener implements DataChangeListener, AutoCloseable {
+
+    private static final Logger LOG = LoggerFactory.getLogger(FaasEndpointManagerListener.class);
+
+    private final ListenerRegistration<DataChangeListener> registerListener;
+
+    public FaasEndpointManagerListener(DataBroker dataProvider) {
+        this.registerListener = checkNotNull(dataProvider).registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
+                IidFactory.endpointsIidWildcard(), this, AsyncDataBroker.DataChangeScope.SUBTREE);
+    }
+
+    @Override
+    public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
+        // Create
+        for (DataObject dao : change.getCreatedData().values()) {
+            if (dao instanceof Endpoint) {
+                LOG.debug("Created Endpoint {}", (Endpoint) dao);
+            } else if (dao instanceof EndpointL3) {
+                LOG.debug("Created EndpointL3 {}", (EndpointL3) dao);
+            } else if (dao instanceof EndpointL3Prefix) {
+                LOG.debug("Created EndpointL3Prefix {}", (EndpointL3Prefix) dao);
+            }
+        }
+        // Update
+        Map<InstanceIdentifier<?>, DataObject> dao = change.getUpdatedData();
+        for (Map.Entry<InstanceIdentifier<?>, DataObject> entry : dao.entrySet()) {
+            if (entry.getValue() instanceof Endpoint) {
+                LOG.debug("Updated Endpoint {}", (Endpoint) dao);
+            } else if (entry.getValue() instanceof EndpointL3) {
+                LOG.debug("Updated EndpointL3 {}", (EndpointL3) dao);
+            } else if (entry.getValue() instanceof EndpointL3Prefix) {
+                LOG.debug("Updated EndpointL3Prefix {}", (EndpointL3Prefix) dao);
+            }
+        }
+        // Remove
+        for (InstanceIdentifier<?> iid : change.getRemovedPaths()) {
+            DataObject old = change.getOriginalData().get(iid);
+            if (old == null) {
+                continue;
+            }
+            if (old instanceof Endpoint) {
+                LOG.debug("Removed Endpoint {}", (Endpoint) old);
+            } else if (old instanceof EndpointL3) {
+                LOG.debug("Removed EndpointL3 {}", (EndpointL3) old);
+            } else if (old instanceof EndpointL3Prefix) {
+                LOG.debug("Removed EndpointL3Prefix {}", (EndpointL3Prefix) old);
+            }
+        }
+    }
+
+    @Override
+    public void close() throws Exception {
+        if (registerListener != null)
+            registerListener.close();
+    }
+}
diff --git a/renderers/faas/src/main/java/org/opendaylight/groupbasedpolicy/renderer/faas/FaasRenderer.java b/renderers/faas/src/main/java/org/opendaylight/groupbasedpolicy/renderer/faas/FaasRenderer.java
new file mode 100644 (file)
index 0000000..7f18f05
--- /dev/null
@@ -0,0 +1,52 @@
+package org.opendaylight.groupbasedpolicy.renderer.faas;
+
+/*
+ * Copyright (c) 2015 Huawei Technologies 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
+ */
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Renderer that converts GBP services to FAAS logical networks, which then maps
+ * to the physical networks..
+ */
+public class FaasRenderer implements AutoCloseable {
+
+    private static final Logger LOG = LoggerFactory.getLogger(FaasRenderer.class);
+
+    private final DataBroker dataBroker;
+    private final ScheduledExecutorService executor;
+
+    private final FaasEndpointManagerListener endpointListner;
+
+    public FaasRenderer(final DataBroker dataProvider, RpcProviderRegistry rpcRegistry,
+            NotificationService notificationService) {
+        super();
+        this.dataBroker = dataProvider;
+
+        int numCPU = Runtime.getRuntime().availableProcessors();
+        executor = Executors.newScheduledThreadPool(numCPU * 2);
+
+        endpointListner = new FaasEndpointManagerListener(dataProvider);
+
+        LOG.info("FAAS Renderer has Started");
+    }
+
+    @Override
+    public void close() throws Exception {
+        executor.shutdownNow();
+        endpointListner.close();
+    }
+
+}
diff --git a/renderers/faas/src/main/yang/faas-endpoint.yang b/renderers/faas/src/main/yang/faas-endpoint.yang
new file mode 100644 (file)
index 0000000..1ac4a23
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015 Huawei Technologies 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
+ */
+
+module faas-endpoint {
+    yang-version 1;
+    namespace "urn:opendaylight:faas:faas-endpoint";
+    prefix "faas-endpoint";
+
+    import yang-ext { prefix ext; revision-date "2013-07-09"; }
+    import opendaylight-inventory { prefix inv; revision-date "2013-08-19"; }
+    import gbp-common { prefix gbp-common; }
+    import endpoint { prefix endpoint; }
+
+    revision 2015-10-09 {
+        description "Initial revision";
+    }
+
+    grouping switch-attach-location {
+        description
+                "The switch attachment for this endpoint";
+
+        leaf node-id {
+            description "The switch for this attached point";
+            type inv:node-id;
+        }
+
+        leaf node-connector-id {
+            description "The node connector that this point is attached to";
+            type inv:node-connector-id;
+        }
+    }
+
+    grouping endpoint-ext-fields {
+        leaf subnet-id {
+            description "The subnet Id";
+            type gbp-common:unique-id;
+        }
+        uses switch-attach-location;
+    }
+
+    augment "/endpoint:endpoints/endpoint:endpoint" {
+        ext:augment-identifier "faas-endpoint-context";
+        uses endpoint-ext-fields;
+    }
+
+    augment "/endpoint:register-endpoint/endpoint:input" {
+        ext:augment-identifier "faas-endpoint-context-input";
+        uses endpoint-ext-fields;
+    }
+}
diff --git a/renderers/faas/src/main/yang/faas-provider-impl.yang b/renderers/faas/src/main/yang/faas-provider-impl.yang
new file mode 100644 (file)
index 0000000..df5b2d0
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015 Huawei Technologies 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
+ */
+
+module faas-provider-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:faas-provider:impl";
+    prefix "faas-provider-impl";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+    import opendaylight-sal-binding-broker-impl { prefix sal-broker; revision-date 2013-10-28; }
+
+    description
+        "This module contains the base YANG definitions for faas-provider
+        impl implementation.";
+
+    revision "2015-10-09" {
+        description
+                "Initial revision.";
+    }
+
+    identity faas-provider-impl {
+        base "config:module-type";
+
+        config:java-name-prefix FaasProvider;
+    }
+
+    // Augments the 'configuration' choice node under modules/module.
+    augment "/config:modules/config:module/config:configuration" {
+        case faas-provider-impl {
+            when "/config:modules/config:module/config:type = 'faas-provider-impl'";
+
+            //wires in the data-broker service 
+            container data-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-async-data-broker;
+                    }
+                }
+            }
+            // RPC Registry
+            container rpc-registry {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-rpc-registry;
+                    }
+                }
+            }
+            // Notification service
+            container notification-adapter {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity sal-broker:binding-new-notification-service;
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/renderers/faas/src/main/yang/faas-provider.yang b/renderers/faas/src/main/yang/faas-provider.yang
new file mode 100644 (file)
index 0000000..45bb860
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015 Huawei Technologies 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
+ */
+
+module faas-provider {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:faas-provider";
+    prefix "faas-provider";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    description
+        "This module contains the base YANG definitions for faas-provider
+        services.";
+
+    revision "2015-10-09" {
+        description
+                "Initial revision.";
+    }
+
+    identity faas-provider {
+        base "config:service-type";
+        config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.faas.rev151009.FaasData";
+    }
+}
diff --git a/renderers/faas/src/main/yang/faas.yang b/renderers/faas/src/main/yang/faas.yang
new file mode 100644 (file)
index 0000000..e8fcd48
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+module faas {
+    yang-version 1;
+
+    namespace "urn:opendaylight:groupbasedpolicy:faas";
+    prefix "faas";
+
+    import gbp-common { prefix gbp-common; }
+    import endpoint { prefix endpoint; }
+    import resolved-policy { prefix resolved-policy; }
+
+    description
+        "This module defines the group-based policy faas renderer model.";
+
+    revision "2015-10-09" {
+        description
+                "Initial revision.";
+    }
+
+    grouping has-contract-key {
+        leaf contract-tenant-id {
+            description "Related tenant id";
+            type gbp-common:tenant-id;
+        }
+
+        leaf contract-id {
+            description "Related contract id";
+            type gbp-common:contract-id;
+        }
+    }
+
+    container mapped-service-profiles {
+        description "The list of mapped services";
+
+        config false;
+
+        list mapped-service-profile {
+            description "a service is an EPG-Contract-EPG";
+
+            key "consumer-epg-id contract-id provider-epg-id";
+
+            uses resolved-policy:has-consumer-epg-key;
+            uses has-contract-key;
+            uses resolved-policy:has-provider-epg-key;
+            leaf faas-security-rules-groups {
+                description "Faas rules generated from GBP contract";
+                type gbp-common:uuid;
+            }
+            leaf-list faas-routers {
+                description "Faas logical routers";
+                type gbp-common:uuid;
+            }
+            leaf-list faas-switches {
+                description "Faas logical switches";
+                type gbp-common:uuid;
+            }
+            leaf-list faas-ports {
+                description "Faas logical ports";
+                type gbp-common:uuid;
+            }
+            leaf-list faas-subnets {
+                description "Faas subnets";
+                type gbp-common:uuid;
+            }
+        }
+        list mapped-endpoints {
+            uses endpoint:l2-key;
+            leaf-list faas-ports {
+                description "Faas logical ports";
+                type gbp-common:uuid;
+            }
+        }
+    }
+}
index da9137a6135867311a2d471a5069c9c22cb6311a..9f43134981efaec47447baaab86bb9673c851dad 100644 (file)
@@ -19,6 +19,7 @@
 
   <modules>
     <module>ofoverlay</module>
+    <module>faas</module>
   </modules>
 
   <dependencies>