--- /dev/null
+*.class
+**/target
+bin/
+dist
+**/logs
+*~
+target
+target-ide
+.classpath
+.project
+.settings
+.idea
+xtend-gen
+yang-gen-config
+yang-gen-sal
+classes
+.DS_STORE
+.metadata
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2016 SNLAB 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.mdsal</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-api</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+</project>
--- /dev/null
+module alto-auto-maps {
+ yang-version 1;
+ namespace "urn:opendaylight:alto:basic:auto:maps";
+ prefix "alto-auto-maps";
+
+ revision "2015-01-05" {
+ description "Initial revision of alto-auto-maps model";
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2016 SNLAB 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.odlparent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-artifacts</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2016 SNLAB 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.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-cli</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <!-- Project Dependencies -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Apache Karaf console dependency -->
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ <version>${karaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.table</artifactId>
+ <version>${karaf.version}</version>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+/*
+ * Copyright © 2016 SNLAB 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.alto.basic.cli.api;
+
+public interface AltoAutoMapsCliCommands {
+
+ /**
+ * Define the Karaf command method signatures and the Javadoc for each.
+ * Below method is just an example
+ */
+ Object testCommand(Object testArgument);
+}
--- /dev/null
+/*
+ * Copyright © 2016 SNLAB 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.alto.basic.cli.commands;
+
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.console.AbstractAction;
+import org.opendaylight.alto.basic.cli.api.AltoAutoMapsCliCommands;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is an example class. The class name can be renamed to match the command implementation that it will invoke.
+ * Specify command details by updating the fields in the Command annotation below.
+ */
+@Command(name = "test-command", scope = "add the scope of the command, usually project name", description = "add a description for the command")
+public class AltoAutoMapsCliTestCommand extends AbstractAction {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AltoAutoMapsCliTestCommand.class);
+ protected final AltoAutoMapsCliCommands service;
+
+ public AltoAutoMapsCliTestCommand(final AltoAutoMapsCliCommands service) {
+ this.service = service;
+ }
+
+ /**
+ * Add the arguments required by the command.
+ * Any number of arguments can be added using the Option annotation
+ * The below argument is just an example and should be changed as per your requirements
+ */
+ @Option(name = "-tA",
+ aliases = { "--testArgument" },
+ description = "test command argument",
+ required = true,
+ multiValued = false)
+ private Object testArgument;
+
+ @Override
+ protected Object doExecute() throws Exception {
+ /**
+ * Invoke commannd implementation here using the service instance.
+ * Implement how you want the output of the command to be displayed.
+ * Below is just an example.
+ */
+ final String testMessage = (String) service.testCommand(testArgument);
+ return testMessage;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2016 SNLAB 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.alto.basic.cli.impl;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.opendaylight.alto.basic.cli.api.AltoAutoMapsCliCommands;
+
+public class AltoAutoMapsCliCommandsImpl implements AltoAutoMapsCliCommands {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AltoAutoMapsCliCommandsImpl.class);
+ private final DataBroker dataBroker;
+
+ public AltoAutoMapsCliCommandsImpl(final DataBroker db) {
+ this.dataBroker = db;
+ LOG.info("AltoAutoMapsCliCommandImpl initialized");
+ }
+
+ @Override
+ public Object testCommand(Object testArgument) {
+ return "This is a test implementation of test-command";
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=2 tabstop=2: -->
+<!--
+Copyright © 2016 SNLAB 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"
+ odl:type="default" />
+
+ <bean id="cliCommandsImpl" class="org.opendaylight.alto.basic.cli.impl.AltoAutoMapsCliCommandsImpl">
+ <argument ref="dataBroker" />
+ </bean>
+ <service ref="cliCommandsImpl" odl:type="default"
+ interface="org.opendaylight.alto.basic.cli.api.AltoAutoMapsCliCommands" />
+
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
+ <command name="test-command">
+ <action class="org.opendaylight.alto.basic.cli.commands.AltoAutoMapsCliTestCommand">
+ <argument ref="cliCommandsImpl"/>
+ </action>
+ </command>
+ </command-bundle>
+</blueprint>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=2 tabstop=2: -->
+<!--
+ Copyright (c) 2016 SNLAB 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>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>deploy-site</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <stream>latest</stream>
+ <nexus.site.url>dav:https://nexus.opendaylight.org/content/sites/site/${project.groupId}/${stream}/</nexus.site.url>
+ </properties>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.9</version>
+ </extension>
+ </extensions>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.4</version>
+ <configuration>
+ <inputDirectory>${project.build.directory}/staged-site</inputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <site>
+ <id>opendaylight-site</id>
+ <url>${nexus.site.url}</url>
+ </site>
+ </distributionManagement>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2016 SNLAB 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>features-parent</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-features</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+
+ <properties>
+ <mdsal.model.version>0.9.0-SNAPSHOT</mdsal.model.version>
+ <mdsal.version>1.4.0-SNAPSHOT</mdsal.version>
+ <restconf.version>1.4.0-SNAPSHOT</restconf.version>
+ <yangtools.version>1.0.0-SNAPSHOT</yangtools.version>
+ <dlux.version>0.4.0-SNAPSHOT</dlux.version>
+ <configfile.directory>etc/opendaylight/karaf</configfile.directory>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- project specific dependencies -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>${mdsal.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>restconf-artifacts</artifactId>
+ <version>${restconf.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yangtools-artifacts</artifactId>
+ <version>${yangtools.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>features-mdsal-model</artifactId>
+ <version>${mdsal.model.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>features-restconf</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.dlux</groupId>
+ <artifactId>features-dlux</artifactId>
+ <classifier>features</classifier>
+ <version>${dlux.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-cli</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2016 SNLAB 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
+-->
+<features name="odl-alto-auto-maps-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+ <repository>mvn:org.opendaylight.yangtools/features-yangtools/{{VERSION}}/xml/features</repository>
+ <repository>mvn:org.opendaylight.controller/features-mdsal/{{VERSION}}/xml/features</repository>
+ <repository>mvn:org.opendaylight.mdsal.model/features-mdsal-model/{{VERSION}}/xml/features</repository>
+ <repository>mvn:org.opendaylight.netconf/features-restconf/{{VERSION}}/xml/features</repository>
+ <repository>mvn:org.opendaylight.dlux/features-dlux/{{VERSION}}/xml/features</repository>
+ <feature name='odl-alto-auto-maps-api' version='${project.version}' description='OpenDaylight :: alto-auto-maps :: api'>
+ <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
+ <bundle>mvn:org.opendaylight.alto.basic/alto-auto-maps-api/{{VERSION}}</bundle>
+ </feature>
+ <feature name='odl-alto-auto-maps' version='${project.version}' description='OpenDaylight :: alto-auto-maps'>
+ <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
+ <feature version='${project.version}'>odl-alto-auto-maps-api</feature>
+ <bundle>mvn:org.opendaylight.alto.basic/alto-auto-maps-impl/{{VERSION}}</bundle>
+ </feature>
+ <feature name='odl-alto-auto-maps-rest' version='${project.version}' description='OpenDaylight :: alto-auto-maps :: REST'>
+ <feature version="${project.version}">odl-alto-auto-maps</feature>
+ <feature version="${restconf.version}">odl-restconf</feature>
+ </feature>
+ <feature name='odl-alto-auto-maps-ui' version='${project.version}' description='OpenDaylight :: alto-auto-maps :: UI'>
+ <feature version="${project.version}">odl-alto-auto-maps-rest</feature>
+ <feature version="${restconf.version}">odl-mdsal-apidocs</feature>
+ <feature version="${mdsal.version}">odl-mdsal-xsql</feature>
+ <feature version="${dlux.version}">odl-dlux-yangui</feature>
+ </feature>
+ <feature name='odl-alto-auto-maps-cli' version='${project.version}' description='OpenDaylight :: alto-auto-maps :: CLI'>
+ <feature version="${project.version}">odl-alto-auto-maps</feature>
+ <bundle>mvn:org.opendaylight.alto.basic/alto-auto-maps-cli/{{VERSION}}</bundle>
+ </feature>
+
+</features>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=2 tabstop=2: -->
+<!--
+Copyright © 2016 SNLAB 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.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-impl</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <mdsal.version>1.4.0-SNAPSHOT</mdsal.version>
+ <l2switch.version>0.4.0-SNAPSHOT</l2switch.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-manual-maps-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-networkmap-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-costmap-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <artifactId>model-topology</artifactId>
+ <version>${mdsal.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.l2switch.hosttracker</groupId>
+ <artifactId>hosttracker-model</artifactId>
+ <version>${l2switch.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.l2switch.addresstracker</groupId>
+ <artifactId>addresstracker-model</artifactId>
+ <version>${l2switch.version}</version>
+ </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>
--- /dev/null
+/*
+ * Copyright © 2016 SNLAB 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.alto.basic.impl;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AltoAutoMapsProvider {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AltoAutoMapsProvider.class);
+
+ private final DataBroker dataBroker;
+ private AltoAutoMapsUpdateListener m_listener;
+
+ public AltoAutoMapsProvider(final DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ this.m_listener = new AltoAutoMapsUpdateListener(dataBroker);
+ }
+
+ /**
+ * Method called when the blueprint container is created.
+ */
+ public void init() {
+ LOG.info("AltoAutoMapsProvider Session Initiated");
+ }
+
+ /**
+ * Method called when the blueprint container is destroyed.
+ */
+ public void close() {
+ LOG.info("AltoAutoMapsProvider Closed");
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2016 SNLAB 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.alto.basic.impl;
+
+import org.opendaylight.alto.basic.manual.maps.ManualMapsUtils;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.address.tracker.rev140617.address.node.connector.Addresses;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.manual.maps.networkmap.rev151021.EndpointAddressType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.manual.maps.networkmap.rev151021.endpoint.address.group.EndpointAddressGroup;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.manual.maps.networkmap.rev151021.endpoint.address.group.EndpointAddressGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.types.rev150921.PidName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140624.HostNode;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+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;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+public class AltoAutoMapsUpdateListener implements DataChangeListener, AutoCloseable {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AltoAutoMapsUpdateListener.class);
+
+ private final DataBroker dataBroker;
+ private ListenerRegistration<DataChangeListener> registration;
+
+ private static final String TOPOLOGY_NAME = "flow:1";
+ private static final String DEFAULT_AUTO_NETWORKMAP = "default-auto-networkmap";
+ private static final String DEFAULT_AUTO_COSTMAP = "default-auto-costmap";
+ private static final String DEFAULT_PID = "PID0";
+
+ public AltoAutoMapsUpdateListener(final DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ InstanceIdentifier<Topology> iid = InstanceIdentifier
+ .builder(NetworkTopology.class)
+ .child(Topology.class,
+ new TopologyKey(new TopologyId(TOPOLOGY_NAME)))
+ .build();
+ this.registration = dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
+ iid, this, AsyncDataBroker.DataChangeScope.BASE);
+ }
+
+ @Override
+ public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event) {
+ if (event == null) {
+ return;
+ }
+
+ final ReadWriteTransaction rwx = dataBroker.newReadWriteTransaction();
+
+ Map<InstanceIdentifier<?>, DataObject> original = event.getOriginalData();
+
+ for (Map.Entry<InstanceIdentifier<?>, DataObject> entry : event.getCreatedData().entrySet()) {
+ InstanceIdentifier<?> iid = entry.getKey();
+ DataObject created = entry.getValue();
+
+ if (created instanceof Topology) {
+ createDefaultAutoNetworkMap((Topology) created, rwx);
+ LOG.info("Create default auto networkmap");
+ }
+ }
+
+ for (InstanceIdentifier<?> iid : event.getRemovedPaths()) {
+ DataObject removed = original.get(iid);
+
+ if (removed instanceof Topology) {
+ emptyDefaultAutoNetworkMap(rwx);
+ LOG.info("Empty default auto networkmap");
+ }
+ }
+
+ for (Map.Entry<InstanceIdentifier<?>, DataObject> entry : event.getUpdatedData().entrySet()) {
+ InstanceIdentifier<?> iid = entry.getKey();
+ DataObject updated = entry.getValue();
+
+ if (updated instanceof Topology) {
+ updateDefaultAutoNetworkMap((Topology) updated, rwx);
+ LOG.info("Update default auto networkmap");
+ }
+ }
+
+ rwx.submit();
+ }
+
+ private void createDefaultAutoNetworkMap(Topology topology, final WriteTransaction wx) {
+ for (Node node : topology.getNode()) {
+ HostNode hostNode = node.getAugmentation(HostNode.class);
+ if (hostNode != null) {
+ List<Addresses> addressesList = hostNode.getAddresses();
+ mergeAddressesListToDefaultNetworkMap(addressesList, wx);
+ }
+ }
+ }
+
+ private void emptyDefaultAutoNetworkMap(final WriteTransaction wx) {
+ mergeAddressesListToDefaultNetworkMap(new LinkedList<Addresses>(), wx);
+ }
+
+ private void updateDefaultAutoNetworkMap(Topology topology, final WriteTransaction wx) {
+ // TODO: can be more efficient
+ emptyDefaultAutoNetworkMap(wx);
+ createDefaultAutoNetworkMap(topology, wx);
+ }
+
+ private void mergeAddressesListToDefaultNetworkMap(List<Addresses> addressesList, final WriteTransaction wx) {
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic
+ .manual.maps.networkmap.rev151021.network.map.Map> networkMap = new LinkedList<>();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic
+ .manual.maps.networkmap.rev151021.network.map.MapBuilder builder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic
+ .manual.maps.networkmap.rev151021.network.map.MapBuilder();
+
+ List<IpPrefix> prefixList = aggregateAddressesList(addressesList);
+
+ List<EndpointAddressGroup> emptyEndpointAddressGroup = new LinkedList<>();
+ emptyEndpointAddressGroup.add(new EndpointAddressGroupBuilder()
+ .setAddressType(new EndpointAddressType(EndpointAddressType.Enumeration.Ipv4))
+ .setEndpointPrefix(prefixList)
+ .build());
+
+ builder.setPid(new PidName("PID0"))
+ .setEndpointAddressGroup(emptyEndpointAddressGroup);
+ networkMap.add(builder.build());
+
+ ManualMapsUtils.createResourceNetworkMap(DEFAULT_AUTO_NETWORKMAP, networkMap, wx);
+ }
+
+ private List<IpPrefix> aggregateAddressesList(List<Addresses> addressesList) {
+ List<IpPrefix> prefixList = new LinkedList<>();
+ for (Addresses addresses : addressesList) {
+ if (addresses.getIp() == null)
+ continue;
+ String ipAddress = addresses.getIp().getIpv4Address().getValue();
+
+ IpPrefix prefix = new IpPrefix(new Ipv4Prefix(ipAddress + "/32"));
+ prefixList.add(prefix);
+ }
+
+ return prefixList;
+ }
+
+ @Override
+ public void close() throws Exception {
+ registration.close();
+ LOG.info("AltoAutoMapsUpdateListener Closed");
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=2 tabstop=2: -->
+<!--
+Copyright © 2016 SNLAB 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"
+ odl:type="default" />
+
+ <bean id="provider"
+ class="org.opendaylight.alto.basic.impl.AltoAutoMapsProvider"
+ init-method="init" destroy-method="close">
+ <argument ref="dataBroker" />
+ </bean>
+
+</blueprint>
--- /dev/null
+/*
+ * Copyright © 2016 SNLAB 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.alto.basic.impl;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
+import static org.mockito.Mockito.mock;
+
+public class AltoAutoMapsProviderTest {
+
+ private DataBroker dataBroker = mock(DataBroker.class);
+ private AltoAutoMapsProvider provider;
+
+ @Before
+ public void setUp() throws Exception {
+ provider = new AltoAutoMapsProvider(dataBroker);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testInit() throws Exception {
+ provider.init();
+ }
+
+ @Test
+ public void testClose() throws Exception {
+ provider.close();
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2016 SNLAB 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.alto.basic.impl;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.address.tracker.rev140617.address.node.connector.AddressesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140624.HostNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140624.HostNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class AltoAutoMapsUpdateListenerTest {
+
+ private static final String TOPOLOGY_NAME = "flow:1";
+
+ private DataBroker dataBroker = mock(DataBroker.class);
+ private ListenerRegistration<DataChangeListener> registration = mock(ListenerRegistration.class);
+ private AltoAutoMapsUpdateListener altoAutoMapsUpdateListener;
+ private ReadWriteTransaction rwx = mock(ReadWriteTransaction.class);
+ private InstanceIdentifier<Topology> iid = InstanceIdentifier
+ .builder(NetworkTopology.class)
+ .child(Topology.class,
+ new TopologyKey(new TopologyId(TOPOLOGY_NAME)))
+ .build();
+
+ private AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> mockDataChangeEvent =
+ mock(AsyncDataChangeEvent.class);
+ private Map<InstanceIdentifier<?>, DataObject> original = new HashMap<>();
+ private Map<InstanceIdentifier<?>, DataObject> createdData = new HashMap<>();
+ private Set<InstanceIdentifier<?>> removedPaths = new HashSet<>();
+ private Map<InstanceIdentifier<?>, DataObject> updatedData = new HashMap<>();
+
+ @Before
+ public void setUp() throws Exception {
+ when(dataBroker.registerDataChangeListener(
+ any(LogicalDatastoreType.class),
+ any(InstanceIdentifier.class),
+ any(DataChangeListener.class),
+ any(AsyncDataBroker.DataChangeScope.class)
+ )).thenReturn(registration);
+
+ when(dataBroker.newReadWriteTransaction()).thenReturn(rwx);
+
+ altoAutoMapsUpdateListener = new AltoAutoMapsUpdateListener(dataBroker);
+
+ original.put(iid, new TopologyBuilder().build());
+ removedPaths.add(iid);
+
+ Topology testTopology = new TopologyBuilder()
+ .setNode(Arrays.asList(new NodeBuilder().build()))
+ .build();
+ createdData.put(iid, testTopology);
+
+ Topology testTopologyWithHost = new TopologyBuilder()
+ .setNode(Arrays.asList(new NodeBuilder()
+ .addAugmentation(HostNode.class,
+ new HostNodeBuilder()
+ .setAddresses(Arrays.asList(new AddressesBuilder()
+ .setIp(new IpAddress(new Ipv4Address("192.168.1.100")))
+ .build(),
+ new AddressesBuilder().build()))
+ .build())
+ .build()))
+ .build();
+ updatedData.put(iid, testTopologyWithHost);
+
+ when(mockDataChangeEvent.getOriginalData()).thenReturn(original);
+ when(mockDataChangeEvent.getCreatedData()).thenReturn(createdData);
+ when(mockDataChangeEvent.getRemovedPaths()).thenReturn(removedPaths);
+ when(mockDataChangeEvent.getUpdatedData()).thenReturn(updatedData);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testOnNullDataChanged() throws Exception {
+ altoAutoMapsUpdateListener.onDataChanged(null);
+ verify(rwx, never()).submit();
+ }
+
+ @Test
+ public void testOnDataChanged() throws Exception {
+ altoAutoMapsUpdateListener.onDataChanged(mockDataChangeEvent);
+ verify(rwx).submit();
+ }
+
+ @Test
+ public void testClose() throws Exception {
+ altoAutoMapsUpdateListener.close();
+ verify(registration).close();
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2016 SNLAB 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.controller</groupId>
+ <artifactId>mdsal-it-parent</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-it</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <skipITs>false</skipITs>
+ <karaf.distro.groupId>org.opendaylight.alto.basic</karaf.distro.groupId>
+ <karaf.distro.artifactId>alto-auto-maps-karaf</karaf.distro.artifactId>
+ <karaf.distro.version>0.1.0-SNAPSHOT</karaf.distro.version>
+ <karaf.distro.type>zip</karaf.distro.type>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-features</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+/*
+ * Copyright © 2016 SNLAB 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.alto.basic.it;
+
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class AltoAutoMapsIT extends AbstractMdsalTestBase {
+ private static final Logger LOG = LoggerFactory.getLogger(AltoAutoMapsIT.class);
+
+ @Override
+ public MavenUrlReference getFeatureRepo() {
+ return maven()
+ .groupId("org.opendaylight.alto.basic")
+ .artifactId("alto-auto-maps-features")
+ .classifier("features")
+ .type("xml")
+ .versionAsInProject();
+ }
+
+ @Override
+ public String getFeatureName() {
+ return "odl-alto-auto-maps-ui";
+ }
+
+ @Override
+ public Option getLoggingOption() {
+ Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+ logConfiguration(AltoAutoMapsIT.class),
+ LogLevel.INFO.name());
+ option = composite(option, super.getLoggingOption());
+ return option;
+ }
+
+ @Test
+ public void testAltoAutoMapsFeatureLoad() {
+ Assert.assertTrue(true);
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2016 SNLAB 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.controller</groupId>
+ <artifactId>karaf-parent</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-karaf</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+
+ <properties>
+ <karaf.localFeature>odl-alto-auto-maps-ui</karaf.localFeature>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-artifacts</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <!-- scope is compile so all features (there is only one) are installed
+ into startup.properties and the feature repo itself is not installed -->
+ <groupId>org.apache.karaf.features</groupId>
+ <artifactId>framework</artifactId>
+ <type>kar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-auto-maps-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- DO NOT deploy the karaf artifact -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2016 SNLAB 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</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-aggregator</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <name>alto-auto-maps</name>
+ <packaging>pom</packaging>
+
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/alto-auto-maps.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/alto-auto-maps.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/alto-auto-maps:Main</url>
+ </scm>
+
+ <!-- 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>
+
+ <profiles>
+ <profile>
+ <id>minimal</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>alto-dev</id>
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ <module>features</module>
+ <module>artifacts</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>alto-test</id>
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ <module>features</module>
+ <module>artifacts</module>
+ <module>karaf</module>
+ <!--<module>it</module>-->
+ </modules>
+ </profile>
+
+ <profile>
+ <!--
+ This profile is to ensure we only build javadocs reports
+ when we plan to deploy Maven site for our project.
+ -->
+ <id>maven-site</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <!--
+ Maven Site Configuration
+
+ The following configuration is necessary for maven-site-plugin to
+ correctly identify the correct deployment path for OpenDaylight Maven
+ sites.
+ -->
+ <url>${odl.site.url}/${project.groupId}/${stream}/</url>
+
+ <distributionManagement>
+ <site>
+ <id>opendaylight-site</id>
+ <url>${nexus.site.url}/</url>
+ </site>
+ </distributionManagement>
+</project>
--- /dev/null
+/* Javadoc style sheet */
+/*
+Overall document style
+*/
+body {
+ background-color:#ffffff;
+ color:#353833;
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:76%;
+ margin:0;
+}
+a:link, a:visited {
+ text-decoration:none;
+ color:#4c6b87;
+}
+a:hover, a:focus {
+ text-decoration:none;
+ color:#bb7a2a;
+}
+a:active {
+ text-decoration:none;
+ color:#4c6b87;
+}
+a[name] {
+ color:#353833;
+}
+a[name]:hover {
+ text-decoration:none;
+ color:#353833;
+}
+pre {
+ font-size:1.3em;
+}
+h1 {
+ font-size:1.8em;
+}
+h2 {
+ font-size:1.5em;
+}
+h3 {
+ font-size:1.4em;
+}
+h4 {
+ font-size:1.3em;
+}
+h5 {
+ font-size:1.2em;
+}
+h6 {
+ font-size:1.1em;
+}
+ul {
+ list-style-type:disc;
+}
+code, tt {
+ font-size:1.2em;
+}
+dt code {
+ font-size:1.2em;
+}
+table tr td dt code {
+ font-size:1.2em;
+ vertical-align:top;
+}
+sup {
+ font-size:.6em;
+}
+/*
+Document title and Copyright styles
+*/
+.clear {
+ clear:both;
+ height:0px;
+ overflow:hidden;
+}
+.aboutLanguage {
+ float:right;
+ padding:0px 21px;
+ font-size:.8em;
+ z-index:200;
+ margin-top:-7px;
+}
+.legalCopy {
+ margin-left:.5em;
+}
+.bar a, .bar a:link, .bar a:visited, .bar a:active {
+ color:#FFFFFF;
+ text-decoration:none;
+}
+.bar a:hover, .bar a:focus {
+ color:#bb7a2a;
+}
+.tab {
+ background-color:#0066FF;
+ background-image:url(resources/titlebar.gif);
+ background-position:left top;
+ background-repeat:no-repeat;
+ color:#ffffff;
+ padding:8px;
+ width:5em;
+ font-weight:bold;
+}
+/*
+Navigation bar styles
+*/
+.bar {
+ background-image:url(resources/background.gif);
+ background-repeat:repeat-x;
+ color:#FFFFFF;
+ padding:.8em .5em .4em .8em;
+ height:auto;/*height:1.8em;*/
+ font-size:1em;
+ margin:0;
+}
+.topNav {
+ background-image:url(resources/background.gif);
+ background-repeat:repeat-x;
+ color:#FFFFFF;
+ float:left;
+ padding:0;
+ width:100%;
+ clear:right;
+ height:2.8em;
+ padding-top:10px;
+ overflow:hidden;
+}
+.bottomNav {
+ margin-top:10px;
+ background-image:url(resources/background.gif);
+ background-repeat:repeat-x;
+ color:#FFFFFF;
+ float:left;
+ padding:0;
+ width:100%;
+ clear:right;
+ height:2.8em;
+ padding-top:10px;
+ overflow:hidden;
+}
+.subNav {
+ background-color:#dee3e9;
+ border-bottom:1px solid #9eadc0;
+ float:left;
+ width:100%;
+ overflow:hidden;
+}
+.subNav div {
+ clear:left;
+ float:left;
+ padding:0 0 5px 6px;
+}
+ul.navList, ul.subNavList {
+ float:left;
+ margin:0 25px 0 0;
+ padding:0;
+}
+ul.navList li{
+ list-style:none;
+ float:left;
+ padding:3px 6px;
+}
+ul.subNavList li{
+ list-style:none;
+ float:left;
+ font-size:90%;
+}
+.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited {
+ color:#FFFFFF;
+ text-decoration:none;
+}
+.topNav a:hover, .bottomNav a:hover {
+ text-decoration:none;
+ color:#bb7a2a;
+}
+.navBarCell1Rev {
+ background-image:url(resources/tab.gif);
+ background-color:#a88834;
+ color:#FFFFFF;
+ margin: auto 5px;
+ border:1px solid #c9aa44;
+}
+/*
+Page header and footer styles
+*/
+.header, .footer {
+ clear:both;
+ margin:0 20px;
+ padding:5px 0 0 0;
+}
+.indexHeader {
+ margin:10px;
+ position:relative;
+}
+.indexHeader h1 {
+ font-size:1.3em;
+}
+.title {
+ color:#2c4557;
+ margin:10px 0;
+}
+.subTitle {
+ margin:5px 0 0 0;
+}
+.header ul {
+ margin:0 0 25px 0;
+ padding:0;
+}
+.footer ul {
+ margin:20px 0 5px 0;
+}
+.header ul li, .footer ul li {
+ list-style:none;
+ font-size:1.2em;
+}
+/*
+Heading styles
+*/
+div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
+ background-color:#dee3e9;
+ border-top:1px solid #9eadc0;
+ border-bottom:1px solid #9eadc0;
+ margin:0 0 6px -8px;
+ padding:2px 5px;
+}
+ul.blockList ul.blockList ul.blockList li.blockList h3 {
+ background-color:#dee3e9;
+ border-top:1px solid #9eadc0;
+ border-bottom:1px solid #9eadc0;
+ margin:0 0 6px -8px;
+ padding:2px 5px;
+}
+ul.blockList ul.blockList li.blockList h3 {
+ padding:0;
+ margin:15px 0;
+}
+ul.blockList li.blockList h2 {
+ padding:0px 0 20px 0;
+}
+/*
+Page layout container styles
+*/
+.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
+ clear:both;
+ padding:10px 20px;
+ position:relative;
+}
+.indexContainer {
+ margin:10px;
+ position:relative;
+ font-size:1.0em;
+}
+.indexContainer h2 {
+ font-size:1.1em;
+ padding:0 0 3px 0;
+}
+.indexContainer ul {
+ margin:0;
+ padding:0;
+}
+.indexContainer ul li {
+ list-style:none;
+}
+.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
+ font-size:1.1em;
+ font-weight:bold;
+ margin:10px 0 0 0;
+ color:#4E4E4E;
+}
+.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
+ margin:10px 0 10px 20px;
+}
+.serializedFormContainer dl.nameValue dt {
+ margin-left:1px;
+ font-size:1.1em;
+ display:inline;
+ font-weight:bold;
+}
+.serializedFormContainer dl.nameValue dd {
+ margin:0 0 0 1px;
+ font-size:1.1em;
+ display:inline;
+}
+/*
+List styles
+*/
+ul.horizontal li {
+ display:inline;
+ font-size:0.9em;
+}
+ul.inheritance {
+ margin:0;
+ padding:0;
+}
+ul.inheritance li {
+ display:inline;
+ list-style:none;
+}
+ul.inheritance li ul.inheritance {
+ margin-left:15px;
+ padding-left:15px;
+ padding-top:1px;
+}
+ul.blockList, ul.blockListLast {
+ margin:10px 0 10px 0;
+ padding:0;
+}
+ul.blockList li.blockList, ul.blockListLast li.blockList {
+ list-style:none;
+ margin-bottom:25px;
+}
+ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
+ padding:0px 20px 5px 10px;
+ border:1px solid #9eadc0;
+ background-color:#f9f9f9;
+}
+ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
+ padding:0 0 5px 8px;
+ background-color:#ffffff;
+ border:1px solid #9eadc0;
+ border-top:none;
+}
+ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
+ margin-left:0;
+ padding-left:0;
+ padding-bottom:15px;
+ border:none;
+ border-bottom:1px solid #9eadc0;
+}
+ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
+ list-style:none;
+ border-bottom:none;
+ padding-bottom:0;
+}
+table tr td dl, table tr td dl dt, table tr td dl dd {
+ margin-top:0;
+ margin-bottom:1px;
+}
+/*
+Table styles
+*/
+.contentContainer table, .classUseContainer table, .constantValuesContainer table {
+ border-bottom:1px solid #9eadc0;
+ width:100%;
+}
+.contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table {
+ width:100%;
+}
+.contentContainer .description table, .contentContainer .details table {
+ border-bottom:none;
+}
+.contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{
+ vertical-align:top;
+ padding-right:20px;
+}
+.contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast,
+.contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast,
+.contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne,
+.contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne {
+ padding-right:3px;
+}
+.overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption {
+ position:relative;
+ text-align:left;
+ background-repeat:no-repeat;
+ color:#FFFFFF;
+ font-weight:bold;
+ clear:none;
+ overflow:hidden;
+ padding:0px;
+ margin:0px;
+}
+caption a:link, caption a:hover, caption a:active, caption a:visited {
+ color:#FFFFFF;
+}
+.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span {
+ white-space:nowrap;
+ padding-top:8px;
+ padding-left:8px;
+ display:block;
+ float:left;
+ background-image:url(resources/titlebar.gif);
+ height:18px;
+}
+.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd {
+ width:10px;
+ background-image:url(resources/titlebar_end.gif);
+ background-repeat:no-repeat;
+ background-position:top right;
+ position:relative;
+ float:left;
+}
+ul.blockList ul.blockList li.blockList table {
+ margin:0 0 12px 0px;
+ width:100%;
+}
+.tableSubHeadingColor {
+ background-color: #EEEEFF;
+}
+.altColor {
+ background-color:#eeeeef;
+}
+.rowColor {
+ background-color:#ffffff;
+}
+.overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td {
+ text-align:left;
+ padding:3px 3px 3px 7px;
+}
+th.colFirst, th.colLast, th.colOne, .constantValuesContainer th {
+ background:#dee3e9;
+ border-top:1px solid #9eadc0;
+ border-bottom:1px solid #9eadc0;
+ text-align:left;
+ padding:3px 3px 3px 7px;
+}
+td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
+ font-weight:bold;
+}
+td.colFirst, th.colFirst {
+ border-left:1px solid #9eadc0;
+ white-space:nowrap;
+}
+td.colLast, th.colLast {
+ border-right:1px solid #9eadc0;
+}
+td.colOne, th.colOne {
+ border-right:1px solid #9eadc0;
+ border-left:1px solid #9eadc0;
+}
+table.overviewSummary {
+ padding:0px;
+ margin-left:0px;
+}
+table.overviewSummary td.colFirst, table.overviewSummary th.colFirst,
+table.overviewSummary td.colOne, table.overviewSummary th.colOne {
+ width:25%;
+ vertical-align:middle;
+}
+table.packageSummary td.colFirst, table.overviewSummary th.colFirst {
+ width:25%;
+ vertical-align:middle;
+}
+/*
+Content styles
+*/
+.description pre {
+ margin-top:0;
+}
+.deprecatedContent {
+ margin:0;
+ padding:10px 0;
+}
+.docSummary {
+ padding:0;
+}
+/*
+Formatting effect styles
+*/
+.sourceLineNo {
+ color:green;
+ padding:0 30px 0 0;
+}
+h1.hidden {
+ visibility:hidden;
+ overflow:hidden;
+ font-size:.9em;
+}
+.block {
+ display:block;
+ margin:3px 0 0 0;
+}
+.strong {
+ font-weight:bold;
+}
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="alto-auto-maps">
+ <body>
+ <menu name="Overview">
+ <item name="Javadocs" href="apidocs/index.html" />
+ </menu>
+ </body>
+</project>
WriteTransaction wx) {
InstanceIdentifier<ResourceNetworkMap> iid = getResourceNetworkMapIID(rid);
ResourceNetworkMapBuilder builder = new ResourceNetworkMapBuilder();
- builder.setTag(new Tag(UUID.nameUUIDFromBytes(rid.getBytes()).toString()));
+ builder.setTag(new Tag(UUID.nameUUIDFromBytes(rid.getBytes()).toString().replaceAll("-", "")));
builder.setResourceId(new ResourceId(rid));
builder.setMap(networkMap);
wx.put(LogicalDatastoreType.CONFIGURATION, iid, builder.build());
WriteTransaction wx) {
InstanceIdentifier<ResourceCostMap> iid = getResourceCostMapIID(rid);
ResourceCostMapBuilder builder = new ResourceCostMapBuilder();
- builder.setTag(new Tag(UUID.nameUUIDFromBytes(rid.getBytes()).toString()));
+ builder.setTag(new Tag(UUID.nameUUIDFromBytes(rid.getBytes()).toString().replaceAll("-", "")));
builder.setResourceId(new ResourceId(rid));
builder.setMap(costMap);
builder.setMeta(meta);
<artifactId>alto-northbound-api</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-northbound-route-networkmap-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-northbound-route-costmap-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-simple-ird-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
<groupId>junit</groupId>
package org.opendaylight.alto.basic.impl;
import org.opendaylight.alto.basic.manual.maps.ManualMapsUtils;
+import org.opendaylight.alto.basic.simpleird.SimpleIrdUtils;
+import org.opendaylight.alto.core.northbound.route.costmap.AltoNbrCostmapUtils;
+import org.opendaylight.alto.core.northbound.route.networkmap.AltoNbrNetworkmapUtils;
import org.opendaylight.alto.core.resourcepool.ResourcepoolUtils;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.manual.maps.networkmap.rev151021.NetworkMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.manual.maps.rev151021.ConfigContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.ServiceContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.types.rev150921.ResourceId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.config.rev151021.ResourceTypeConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.costmap.rev151021.AltoModelCostmapService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.costmap.rev151021.ResourceTypeCostmap;
for (Map.Entry<InstanceIdentifier<?>, DataObject> entry : change.getUpdatedData().entrySet()) {
DataObject origin = original.get(entry.getKey());
+ InstanceIdentifier<?> updatedIID = entry.getKey();
DataObject updated = entry.getValue();
if (updated instanceof NetworkMap) {
- updateNetworkMap((NetworkMap) origin, (NetworkMap) updated);
+ updateNetworkMap((NetworkMap) origin, (NetworkMap) updated,
+ (InstanceIdentifier<NetworkMap>) updatedIID, rwx);
+ LOG.info("Update NetworkMap data from OPERATIONAL");
} else if (updated instanceof CostMap) {
- updateCostMap((CostMap) origin, (CostMap) updated);
+ updateCostMap((CostMap) origin, (CostMap) updated,
+ (InstanceIdentifier<CostMap>) updatedIID, rwx);
+ LOG.info("Update CostMap data from OPERATIONAL");
}
}
rwx.submit();
}
- private void updateNetworkMap(NetworkMap origin, NetworkMap updated) {
- //TODO: No Implementation
+ private void updateNetworkMap(NetworkMap origin, NetworkMap updated, InstanceIdentifier<NetworkMap> updatedIID,
+ final WriteTransaction wx) {
+ ResourceId rid = updated.getResourceId();
+
+ LOG.info("Updating NetworkMap: " + "\n\tResource ID: " + rid.getValue());
+ createNetworkMap(updated, updatedIID, wx);
}
- private void updateCostMap(CostMap origin, CostMap updated) {
- //TODO: No Implementation
+ private void updateCostMap(CostMap origin, CostMap updated, InstanceIdentifier<CostMap> updatedIID,
+ final WriteTransaction wx) {
+ ResourceId rid = updated.getResourceId();
+
+ LOG.info("Updating CostMap: " + "\n\tResource ID: " + rid.getValue());
+ createCostMap(updated, updatedIID, wx);
}
private void removeNetworkMap(InstanceIdentifier<NetworkMap> mapIID, NetworkMap removed, final WriteTransaction wx) {
+ SimpleIrdUtils.deleteConfigEntry(removed.getResourceId(), wx);
+ String path = removed.getResourceId().getValue();
+ AltoNbrNetworkmapUtils.deleteRecord(path, wx);
+
ResourcepoolUtils.deleteResource(new Uuid(ManualMapsUtils.DEFAULT_CONTEXT), removed.getResourceId(), wx);
m_networkmapServiceReg.unregisterPath(ServiceContext.class,
ResourcepoolUtils.getContextTagIID(new Uuid(ManualMapsUtils.DEFAULT_CONTEXT),
}
private void removeCostMap(InstanceIdentifier<CostMap> mapIID, CostMap removed, final WriteTransaction wx) {
+ SimpleIrdUtils.deleteConfigEntry(removed.getResourceId(), wx);
ManualMapsUtils.deleteResourceCostMap(new Uuid(ManualMapsUtils.DEFAULT_CONTEXT), removed.getResourceId(), wx);
m_costmapServiceReg.unregisterPath(ServiceContext.class,
ResourcepoolUtils.getContextTagIID(new Uuid(ManualMapsUtils.DEFAULT_CONTEXT),
private void removeConfigContext(InstanceIdentifier<ConfigContext> iid, ConfigContext removed, final WriteTransaction wx) {
ManualMapsUtils.deleteContext(removed.getContextId(), wx);
removeMap(iid, wx);
+ // TODO: Consistency with SimpleIrd and NrbRecord
}
private void removeMap(InstanceIdentifier<?> mapIID, final WriteTransaction wx) {
ResourcepoolUtils.getContextTagIID(new Uuid(ManualMapsUtils.DEFAULT_CONTEXT),
created.getResourceId(), created.getTag()));
wx.put(LogicalDatastoreType.OPERATIONAL, createdIID, created);
+
+ String path = created.getResourceId().getValue();
+ AltoNbrNetworkmapUtils.createRecord(path, created.getResourceId(), wx);
+ SimpleIrdUtils.createConfigEntry(AltoNbrNetworkmapUtils.BASE_URL + "/" + path,
+ created.getResourceId(), new Uuid(ManualMapsUtils.DEFAULT_CONTEXT), wx);
}
private void createCostMap(CostMap created, InstanceIdentifier<CostMap> createdIID, final WriteTransaction wx) {
ResourcepoolUtils.getContextTagIID(new Uuid(ManualMapsUtils.DEFAULT_CONTEXT),
created.getResourceId(), created.getTag()));
wx.put(LogicalDatastoreType.OPERATIONAL, createdIID, created);
+
+ String path = created.getResourceId().getValue();
+ AltoNbrCostmapUtils.createRecord(path, created.getResourceId(), wx);
+ SimpleIrdUtils.createConfigEntry(AltoNbrCostmapUtils.BASE_URL + "/" + path,
+ created.getResourceId(), new Uuid(ManualMapsUtils.DEFAULT_CONTEXT), wx);
}
private void createConfigContext(ConfigContext created, InstanceIdentifier<ConfigContext> createdIID, final ReadWriteTransaction rwx) {
<module>simple-ird</module>
<module>manual-maps</module>
<module>simple-ecs</module>
+ <module>auto-maps</module>
</modules>
<!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
<build>
import com.google.common.base.Optional;
+import org.opendaylight.alto.core.resourcepool.ResourcepoolUtils;
import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.IrdInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.IrdInstanceKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.IrdInstanceConfiguration;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.IrdInstanceConfigurationKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.ird.entry.configuration.data.location.RelativePathBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.ird.instance.IrdEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.ird.instance.IrdEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.ird.instance.configuration.IrdConfigurationEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.ird.instance.configuration.IrdConfigurationEntryBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.ird.instance.configuration.IrdConfigurationEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.types.rev150921.ResourceId;
public class SimpleIrdUtils {
+ public static final String DEFAULT_IRD_RESOURCE = "default";
+
public static InstanceIdentifier<IrdInstance> getInstanceIID(String rid) {
return getInstanceIID(new ResourceId(rid));
}
}
return null;
}
+
+ public static void createConfigEntry(String path, ResourceId rid, Uuid cid, final WriteTransaction wx) {
+ createConfigEntry(path, new ResourceId(DEFAULT_IRD_RESOURCE), rid, cid, wx);
+ }
+
+ public static void createConfigEntry(String path, ResourceId irdid, ResourceId rid, Uuid cid,
+ final WriteTransaction wx) {
+ IrdConfigurationEntryBuilder builder = new IrdConfigurationEntryBuilder();
+ builder.setEntryId(rid);
+ builder.setInstance(ResourcepoolUtils.getResourceIID(cid, rid));
+ builder.setLocation(new RelativePathBuilder()
+ .setPath(new Uri(path))
+ .build());
+
+ InstanceIdentifier<IrdConfigurationEntry> iceIID = getConfigEntryIID(irdid, rid);
+
+ wx.put(LogicalDatastoreType.CONFIGURATION, iceIID, builder.build());
+ }
+
+ public static void deleteConfigEntry(ResourceId rid, final WriteTransaction wx) {
+ deleteConfigEntry(new ResourceId(DEFAULT_IRD_RESOURCE), rid, wx);
+ }
+
+ public static void deleteConfigEntry(ResourceId irdid, ResourceId rid, final WriteTransaction wx) {
+ InstanceIdentifier<IrdConfigurationEntry> iid = getConfigEntryIID(irdid, rid);
+
+ wx.delete(LogicalDatastoreType.CONFIGURATION, iid);
+ }
}
description
"The context of the resources managed by this IRD instance"
+ "Should follow the format:"
- + "/alto-resourcepool:context[alto-resourcepool:context-id='...'";
+ + "/alto-resourcepool:context[alto-resourcepool:context-id='...']";
}
}
*/
package org.opendaylight.alto.basic.impl;
-import java.util.concurrent.ExecutionException;
-
import org.opendaylight.alto.basic.simpleird.SimpleIrdUtils;
-
import org.opendaylight.alto.core.northbound.api.AltoNorthboundRoute;
import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
import org.opendaylight.alto.core.resourcepool.ResourcepoolUtils;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
-
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.Information;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.InformationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.IrdInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.IrdInstanceConfiguration;
-
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.basic.simple.ird.rev151021.IrdInstanceConfigurationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.types.rev150921.ResourceId;
-
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.concurrent.ExecutionException;
+
public class AltoSimpleIrdProvider implements BindingAwareProvider, AutoCloseable {
public static final String ROOT_INSTANCE = "root";
m_listener.register(m_dataBroker, m_iid);
}
+ protected void createDefaultIrd() throws InterruptedException, ExecutionException {
+ WriteTransaction wx = m_dataBroker.newWriteOnlyTransaction();
+
+ IrdInstanceConfigurationBuilder builder = new IrdInstanceConfigurationBuilder();
+ builder.setEntryContext(ResourcepoolUtils.getDefaultContextIID())
+ .setInstanceId(new ResourceId(SimpleIrdUtils.DEFAULT_IRD_RESOURCE));
+
+ InstanceIdentifier<IrdInstanceConfiguration> iicIID =
+ SimpleIrdUtils.getInstanceConfigurationIID(new ResourceId(SimpleIrdUtils.DEFAULT_IRD_RESOURCE));
+
+ wx.put(LogicalDatastoreType.CONFIGURATION, iicIID, builder.build());
+ wx.submit().get();
+
+ LOG.info("Create default IRD context for SimpleIrd");
+ }
+
protected void deleteContext() throws InterruptedException, ExecutionException {
WriteTransaction wx = m_dataBroker.newWriteOnlyTransaction();
ResourcepoolUtils.deleteContext(m_context, wx);
try {
createContext();
setupListener();
+ createDefaultIrd();
} catch (Exception e) {
LOG.error("Failed to create top-level containers");
e.printStackTrace();
*/
package org.opendaylight.alto.core.northbound.route.costmap;
-/**
- * Created by wukunheng00 on 12/3/15.
- */
-
+import org.opendaylight.alto.core.resourcepool.ResourcepoolUtils;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.costmap.rev151021.Records;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.costmap.rev151021.records.Record;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.costmap.rev151021.records.RecordBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.costmap.rev151021.records.RecordKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.types.rev150921.ResourceId;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class AltoNbrCostmapUtils {
+ public static final String BASE_URL = "/alto/costmap";
+
public static InstanceIdentifier<Record> getRecordIID(String path) {
RecordKey key = new RecordKey(new Uri(path));
return InstanceIdentifier.builder(Records.class).child(Record.class, key).build();
}
+
+ public static String createRecord(String path, ResourceId rid, final WriteTransaction wx) {
+ return createRecord(path, rid, new Uuid(ResourcepoolUtils.DEFAULT_CONTEXT), wx);
+ }
+
+ public static String createRecord(String path, ResourceId rid, Uuid cid, final WriteTransaction wx) {
+ InstanceIdentifier<Record> iid = getRecordIID(path);
+ RecordBuilder builder = new RecordBuilder();
+ builder.setPath(new Uri(path));
+ builder.setResourceIid(ResourcepoolUtils.getResourceIID(cid, rid));
+
+ wx.put(LogicalDatastoreType.CONFIGURATION, iid, builder.build());
+
+ return path;
+ }
+
+ public static void deleteRecord(String path, final WriteTransaction wx) {
+ InstanceIdentifier<Record> iid = getRecordIID(path);
+
+ wx.delete(LogicalDatastoreType.CONFIGURATION, iid);
+ }
}
package org.opendaylight.alto.core.northbound.route.networkmap;
+import org.opendaylight.alto.core.resourcepool.ResourcepoolUtils;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.networkmap.rev151021.Records;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.networkmap.rev151021.records.Record;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.networkmap.rev151021.records.RecordBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.networkmap.rev151021.records.RecordKey;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
-
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.networkmap.rev151021.records.record.AddressTypeMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.networkmap.rev151021.records.record.AddressTypeMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.types.rev150921.ResourceId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.AddressTypeIpv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.AddressTypeIpv6;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import java.util.LinkedList;
+import java.util.List;
+
public class AltoNbrNetworkmapUtils {
+ public static final String BASE_URL = "/alto/networkmap";
+
public static InstanceIdentifier<Record> getRecordIID(String path) {
RecordKey key = new RecordKey(new Uri(path));
return InstanceIdentifier.builder(Records.class).child(Record.class, key).build();
}
+
+ public static String createRecord(String path, ResourceId rid, final WriteTransaction wx) {
+ return createRecord(path, rid, new Uuid(ResourcepoolUtils.DEFAULT_CONTEXT), wx);
+ }
+
+ public static String createRecord(String path, ResourceId rid, Uuid cid, final WriteTransaction wx) {
+ InstanceIdentifier<Record> iid = getRecordIID(path);
+ RecordBuilder builder = new RecordBuilder();
+ builder.setPath(new Uri(path));
+ builder.setResourceIid(ResourcepoolUtils.getResourceIID(cid, rid));
+ List<AddressTypeMapping> addressTypeMappingList = new LinkedList<>();
+ addressTypeMappingList.add(new AddressTypeMappingBuilder()
+ .setAddressTypeString("ipv4")
+ .setAddressType(AddressTypeIpv4.class)
+ .build());
+ addressTypeMappingList.add(new AddressTypeMappingBuilder()
+ .setAddressTypeString("ipv6")
+ .setAddressType(AddressTypeIpv6.class)
+ .build());
+ builder.setAddressTypeMapping(addressTypeMappingList);
+
+ wx.put(LogicalDatastoreType.CONFIGURATION, iid, builder.build());
+
+ return path;
+ }
+
+ public static void deleteRecord(String path, final WriteTransaction wx) {
+ InstanceIdentifier<Record> iid = getRecordIID(path);
+
+ wx.delete(LogicalDatastoreType.CONFIGURATION, iid);
+ }
}
-}
\ No newline at end of file
+}
<artifactId>alto-simple-ecs-api</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-auto-maps-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
description='OpenDaylight :: alto :: Release'>
<feature version='${project.version}'>odl-alto-core</feature>
<feature version='${project.version}'>odl-alto-basic</feature>
+ <feature version='${project.version}'>odl-alto-extension</feature>
</feature>
<feature name='odl-alto-core' version='${project.version}'
<feature version='${project.version}'>odl-alto-simpleird</feature>
<feature version='${project.version}'>odl-alto-manual-maps</feature>
<feature version='${project.version}'>odl-alto-hosttracker</feature>
+ <feature version='${project.version}'>odl-alto-auto-maps</feature>
</feature>
<feature name='odl-alto-extension' version='${project.version}'
<feature version='${project.version}'>odl-alto-northbound</feature>
<feature version='${project.version}'>odl-alto-resourcepool</feature>
<feature version='${project.version}'>odl-alto-standard-service-models</feature>
+ <feature version='${project.version}'>odl-alto-simpleird</feature>
+ <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-networkmap-api/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-costmap-api/${project.version}</bundle>
<bundle>mvn:org.opendaylight.alto.core/alto-service-model-config-api/${project.version}</bundle>
<bundle>mvn:org.opendaylight.alto.basic/alto-manual-maps-api/${project.version}</bundle>
<bundle>mvn:org.opendaylight.alto.basic/alto-manual-maps-impl/${project.version}</bundle>
<feature name='odl-alto-hosttracker' version='${project.version}'
description='OpenDaylight :: alto :: hosttracker'>
- <conditional>
- <condition>odl-l2switch-hosttracker</condition>
- <feature version='${l2switch.version}'>odl-l2switch-addresstracker</feature>
- <feature version='${project.version}'>odl-alto-core</feature>
-
- <bundle>mvn:org.opendaylight.alto.basic/alto-simple-ecs-api/${project.version}</bundle>
- <bundle>mvn:org.opendaylight.alto.basic/alto-simple-ecs-impl/${project.version}</bundle>
- <configfile finalname="${configfile.directory}/alto-hosttracker.xml">
- mvn:org.opendaylight.alto.basic/alto-simple-ecs-impl/${project.version}/xml/config
- </configfile>
- </conditional>
-
- <conditional>
- <condition>odl-alto-spce</condition>
- <feature version='${project.version}'>odl-alto-core</feature>
-
- <bundle>mvn:org.opendaylight.alto.basic/alto-simple-ecs-api/${project.version}</bundle>
- <bundle>mvn:org.opendaylight.alto.basic/alto-simple-ecs-impl/${project.version}</bundle>
- <configfile finalname="${configfile.directory}/alto-hosttracker.xml">
- mvn:org.opendaylight.alto.basic/alto-simple-ecs-impl/${project.version}/xml/config
- </configfile>
- </conditional>
+ <feature version='${l2switch.version}'>odl-l2switch-hosttracker</feature>
+ <feature version='${l2switch.version}'>odl-l2switch-addresstracker</feature>
+ <feature version='${project.version}'>odl-alto-core</feature>
+
+ <bundle>mvn:org.opendaylight.alto.basic/alto-simple-ecs-api/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.alto.basic/alto-simple-ecs-impl/${project.version}</bundle>
+ <configfile finalname="${configfile.directory}/alto-hosttracker.xml">
+ mvn:org.opendaylight.alto.basic/alto-simple-ecs-impl/${project.version}/xml/config
+ </configfile>
+ </feature>
+
+ <feature name='odl-alto-auto-maps' version='${project.version}'
+ description='OpenDaylight :: alto :: auto-maps'>
+ <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
+ <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
+ <feature version='${l2switch.version}'>odl-l2switch-hosttracker</feature>
+ <feature version='${l2switch.version}'>odl-l2switch-addresstracker</feature>
+
+ <feature version='${project.version}'>odl-alto-northbound</feature>
+ <feature version='${project.version}'>odl-alto-resourcepool</feature>
+ <feature version='${project.version}'>odl-alto-standard-service-models</feature>
+ <feature version='${project.version}'>odl-alto-manual-maps</feature>
+
+ <bundle>mvn:org.opendaylight.alto.basic/alto-auto-maps-api/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.alto.basic/alto-auto-maps-impl/${project.version}</bundle>
</feature>
<feature name='odl-alto-nonstandard-types' version='${project.version}'