Initial Bundle setup for coe renderer 59/61559/11
authorFaseela K <faseela.k@ericsson.com>
Fri, 11 Aug 2017 20:46:58 +0000 (02:16 +0530)
committerSam Hague <shague@redhat.com>
Wed, 23 Aug 2017 21:10:01 +0000 (21:10 +0000)
This patch adds the following :

1. coe-renderer-api and coe-renderer-impl bundles
2. Add them to respective features
3. COE Pod and Service Listener skeleton

Change-Id: Ibe692953d40c781a843cb8c4632a1aedd07ab087
Signed-off-by: Faseela K <faseela.k@ericsson.com>
12 files changed:
vpnservice/coe/api/pom.xml [new file with mode: 0644]
vpnservice/coe/impl/pom.xml [new file with mode: 0644]
vpnservice/coe/impl/src/main/java/org/opendaylight/netvirt/coe/PodListener.java [new file with mode: 0644]
vpnservice/coe/impl/src/main/java/org/opendaylight/netvirt/coe/ServiceListener.java [new file with mode: 0644]
vpnservice/coe/impl/src/main/resources/org/opendaylight/blueprint/coe-renderer.xml [new file with mode: 0644]
vpnservice/coe/pom.xml [new file with mode: 0644]
vpnservice/features/odl-netvirt-api/pom.xml
vpnservice/features/odl-netvirt-coe/pom.xml [new file with mode: 0644]
vpnservice/features/odl-netvirt-impl/pom.xml
vpnservice/features/pom.xml
vpnservice/features/vpnservice-features/pom.xml
vpnservice/pom.xml

diff --git a/vpnservice/coe/api/pom.xml b/vpnservice/coe/api/pom.xml
new file mode 100644 (file)
index 0000000..124b775
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2017 Ericsson India Global Services Pvt Ltd. 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.netvirt</groupId>
+    <artifactId>binding-parent</artifactId>
+    <version>0.6.0-SNAPSHOT</version>
+    <relativePath>../../commons/binding-parent</relativePath>
+  </parent>
+
+  <artifactId>coe-api</artifactId>
+  <name>ODL :: netvirt :: ${project.artifactId}</name>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.mdsal</groupId>
+      <artifactId>yang-binding</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-common</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/vpnservice/coe/impl/pom.xml b/vpnservice/coe/impl/pom.xml
new file mode 100644 (file)
index 0000000..763faa2
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2017 Ericsson India Global Services Pvt Ltd. 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.netvirt</groupId>
+    <artifactId>binding-parent</artifactId>
+    <version>0.6.0-SNAPSHOT</version>
+    <relativePath>../../commons/binding-parent</relativePath>
+  </parent>
+
+  <artifactId>coe-impl</artifactId>
+  <name>ODL :: netvirt :: ${project.artifactId}</name>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>coe-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-binding-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.coe</groupId>
+      <artifactId>coe-northbound-api</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.eclipse.xtend</groupId>
+        <artifactId>xtend-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.aries.blueprint</groupId>
+        <artifactId>blueprint-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/vpnservice/coe/impl/src/main/java/org/opendaylight/netvirt/coe/PodListener.java b/vpnservice/coe/impl/src/main/java/org/opendaylight/netvirt/coe/PodListener.java
new file mode 100644 (file)
index 0000000..a8dac8c
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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.netvirt.coe;
+
+import java.util.Collection;
+import javax.annotation.Nonnull;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.pod.rev170611.Coe;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.pod.rev170611.coe.Pods;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Singleton
+public class PodListener implements DataTreeChangeListener<Pods> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(PodListener.class);
+    private ListenerRegistration<PodListener> listenerRegistration;
+    private final DataBroker dataBroker;
+
+    @Inject
+    public PodListener(final DataBroker dataBroker) {
+        registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
+        this.dataBroker = dataBroker;
+    }
+
+    protected InstanceIdentifier<Pods> getWildCardPath() {
+        return InstanceIdentifier.create(Coe.class).child(Pods.class);
+    }
+
+    public void registerListener(LogicalDatastoreType dsType, final DataBroker db) {
+        final DataTreeIdentifier<Pods> treeId = new DataTreeIdentifier<>(dsType, getWildCardPath());
+        listenerRegistration = db.registerDataTreeChangeListener(treeId, PodListener.this);
+    }
+
+    @PreDestroy
+    public void close() {
+        if (listenerRegistration != null) {
+            try {
+                listenerRegistration.close();
+            } finally {
+                listenerRegistration = null;
+            }
+        }
+    }
+
+    @Override
+    public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Pods>> changes) {
+        for (DataTreeModification<Pods> change : changes) {
+            final InstanceIdentifier<Pods> key = change.getRootPath().getRootIdentifier();
+            final DataObjectModification<Pods> mod = change.getRootNode();
+
+            switch (mod.getModificationType()) {
+                case DELETE:
+                    LOG.info("Pod deleted {}", mod.getDataBefore());
+                    break;
+                case SUBTREE_MODIFIED:
+                    LOG.info("Pod updated old : {}, new : {}", mod.getDataBefore(), mod.getDataAfter());
+                    break;
+                case WRITE:
+                    if (mod.getDataBefore() == null) {
+                        LOG.info("Pod added {}", mod.getDataAfter());
+                    } else {
+                        LOG.info("Pod updated old : {}, new : {}", mod.getDataBefore(), mod.getDataAfter());
+                    }
+                    break;
+                default:
+                    // FIXME: May be not a good idea to throw.
+                    throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
+            }
+        }
+    }
+}
diff --git a/vpnservice/coe/impl/src/main/java/org/opendaylight/netvirt/coe/ServiceListener.java b/vpnservice/coe/impl/src/main/java/org/opendaylight/netvirt/coe/ServiceListener.java
new file mode 100644 (file)
index 0000000..0540162
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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.netvirt.coe;
+
+import java.util.Collection;
+import javax.annotation.Nonnull;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.service.rev170611.ServiceInformation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.service.rev170611.service.information.Services;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Singleton
+public class ServiceListener implements DataTreeChangeListener<Services> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ServiceListener.class);
+    private ListenerRegistration<ServiceListener> listenerRegistration;
+    private final DataBroker dataBroker;
+
+    @Inject
+    public ServiceListener(final DataBroker dataBroker) {
+        registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
+        this.dataBroker = dataBroker;
+    }
+
+    protected InstanceIdentifier<Services> getWildCardPath() {
+        return InstanceIdentifier.create(ServiceInformation.class).child(Services.class);
+    }
+
+    public void registerListener(LogicalDatastoreType dsType, final DataBroker db) {
+        final DataTreeIdentifier<Services> treeId = new DataTreeIdentifier<>(dsType, getWildCardPath());
+        listenerRegistration = db.registerDataTreeChangeListener(treeId, ServiceListener.this);
+    }
+
+    @PreDestroy
+    public void close() {
+        if (listenerRegistration != null) {
+            try {
+                listenerRegistration.close();
+            } finally {
+                listenerRegistration = null;
+            }
+        }
+    }
+
+    @Override
+    public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Services>> changes) {
+        for (DataTreeModification<Services> change : changes) {
+            final InstanceIdentifier<Services> key = change.getRootPath().getRootIdentifier();
+            final DataObjectModification<Services> mod = change.getRootNode();
+
+            switch (mod.getModificationType()) {
+                case DELETE:
+                    LOG.info("Service deleted {}", mod.getDataBefore());
+                    break;
+                case SUBTREE_MODIFIED:
+                    LOG.info("Service updated old : {}, new : {}", mod.getDataBefore(), mod.getDataAfter());
+                    break;
+                case WRITE:
+                    if (mod.getDataBefore() == null) {
+                        LOG.info("Service added {}", mod.getDataAfter());
+                    } else {
+                        LOG.info("Service updated old : {}, new : {}", mod.getDataBefore(), mod.getDataAfter());
+                    }
+                    break;
+                default:
+                    // FIXME: May be not a good idea to throw.
+                    throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
+            }
+        }
+    }
+}
diff --git a/vpnservice/coe/impl/src/main/resources/org/opendaylight/blueprint/coe-renderer.xml b/vpnservice/coe/impl/src/main/resources/org/opendaylight/blueprint/coe-renderer.xml
new file mode 100644 (file)
index 0000000..a684467
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2017 Ericsson India Global Services Pvt Ltd. 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           odl:use-default-for-reference-types="true">
+
+    <reference id="dataBroker"
+               interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" />
+
+</blueprint>
diff --git a/vpnservice/coe/pom.xml b/vpnservice/coe/pom.xml
new file mode 100644 (file)
index 0000000..92f22fb
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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 INTERNAL
+-->
+<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.odlparent</groupId>
+    <artifactId>odlparent-lite</artifactId>
+    <version>2.0.4</version>
+    <relativePath/>
+  </parent>
+
+  <artifactId>coe-aggregator</artifactId>
+  <name>ODL :: netvirt :: ${project.artifactId}</name>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>api</module>
+    <module>impl</module>
+  </modules>
+
+  <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
index 639f12d4bc5fc954ea4d9cc2228bcd3eb07563f1..86e9a98099998b2039201dda5a24475ec90e7eae 100644 (file)
             <artifactId>cloud-servicechain-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>coe-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>
diff --git a/vpnservice/features/odl-netvirt-coe/pom.xml b/vpnservice/features/odl-netvirt-coe/pom.xml
new file mode 100644 (file)
index 0000000..ded8891
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright © 2017 Red Hat, Inc. and others.
+
+ 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.odlparent</groupId>
+        <artifactId>single-feature-parent</artifactId>
+        <version>2.0.4</version>
+        <relativePath/>
+    </parent>
+
+    <groupId>org.opendaylight.netvirt</groupId>
+    <artifactId>odl-netvirt-coe</artifactId>
+    <name>OpenDaylight :: NetVirt :: Coe</name>
+    <version>0.6.0-SNAPSHOT</version>
+    <packaging>feature</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.coe</groupId>
+            <artifactId>odl-coe-api</artifactId>
+            <version>0.3.0-SNAPSHOT</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>odl-netvirt-impl</artifactId>
+            <version>${project.version}</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
+    </dependencies>
+</project>
index 1a381b7bf0552bc61142a789b94f3787227b0ef0..4ab53bc85c1717184d5abe58838de0ba60bf54c6 100644 (file)
             <artifactId>statistics-impl</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>coe-impl</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <!-- finalname="etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml" -->
             <groupId>${project.groupId}</groupId>
index 6dbbc0b00342fe7513844f2d9580688ba6b8c7fd..1b312b5a2b5cfd39908f3621bb6bcee7e39ac1e6 100644 (file)
     <modules>
         <module>vpnservice-features</module>
         <module>odl-netvirt-api</module>
+        <module>odl-netvirt-coe</module>
         <module>odl-netvirt-impl</module>
         <module>odl-netvirt-openstack</module>
-        <module>odl-netvirt-ui</module>
         <module>odl-netvirt-sfc</module>
+        <module>odl-netvirt-ui</module>
     </modules>
 
     <!-- Maven Site Configuration The following configuration is necessary
index f6339794f710e4353b9cf2b875990a5f26d02ee8..6639afaf4dd94561d56b197dfc35ab8ca94fd887 100644 (file)
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>odl-netvirt-coe</artifactId>
+            <version>${project.version}</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>odl-netvirt-impl</artifactId>
@@ -60,5 +67,4 @@
             <classifier>features</classifier>
         </dependency>
     </dependencies>
-    
 </project>
index 1b44804f89590a39a2f3a73c85c953f1821b820c..af8261e161e8156cc5a9c14234151671941fc545 100644 (file)
@@ -20,6 +20,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
   <packaging>pom</packaging>
   <modelVersion>4.0.0</modelVersion>
   <modules>
+    <module>coe</module>
     <module>commons</module>
     <module>model-bgp</module>
     <module>vpnmanager</module>