<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>
<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>
<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
-->
--- /dev/null
+<?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>
--- /dev/null
+<?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&revision=2015-10-09</capability>
+ </required-capabilities>
+
+</snapshot>
<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>
--- /dev/null
+<?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>
--- /dev/null
+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());
+ }
+
+}
--- /dev/null
+/*
+ * 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 {
+
+}
--- /dev/null
+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();
+ }
+}
--- /dev/null
+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();
+ }
+
+}
--- /dev/null
+/*
+ * 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;
+ }
+}
--- /dev/null
+/*
+ * 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;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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";
+ }
+}
--- /dev/null
+/*
+ * 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;
+ }
+ }
+ }
+}
<modules>
<module>ofoverlay</module>
+ <module>faas</module>
</modules>
<dependencies>