--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University 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">
+ <parent>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-networkmap-api</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-basic-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-resourcepool-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-base-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>yang-ext</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types-2013-07-15</artifactId>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+module alto-model-networkmap {
+ yang-version 1;
+
+ namespace "urn:opendaylight:alto:service:model:networkmap";
+
+ prefix "alto-model-networkmap";
+
+ import "alto-basic-types" {
+ prefix "alto-types";
+ }
+
+ import "alto-resourcepool" {
+ prefix "alto-resourcpool";
+ }
+
+ import "alto-model-base" {
+ prefix "base";
+ }
+
+ import "ietf-inet-types" {
+ prefix "ietf-inet";
+ }
+
+ organization "Yale University";
+
+ contact "alto-dev@lists.opendaylight.org";
+
+ revision "2015-10-21" {
+ description "Initial revision of alto networkmap";
+ }
+
+ identity "resource-type-networkmap" {
+ base "alto-resourcepool:resource-type";
+ description
+ "The resource type for network map";
+ }
+
+ identity "property-type" {
+ description
+ "Base type for PID properties";
+ }
+
+ identity "address-type-base" {
+ base "property-type";
+ description
+ "Base type for address type";
+ }
+
+ grouping "networkmap-request-data" {
+ container "networkmap-filter" {
+ leaf-list "pid" {
+ type "alto-types:pid-name";
+ }
+
+ leaf-list "address-type" {
+ type "identityref" {
+ base "alto-model-networkmap:address-type-base";
+ }
+ }
+ }
+ }
+
+ grouping "networkmap-response-data" {
+ container "network-map" {
+ list "partition" {
+ key "pid";
+
+ leaf "pid" {
+ type "alto-types:pid-name";
+ }
+
+ list "property" {
+ key "property-type";
+
+ leaf "property-type" {
+ type "identityref" {
+ base "alto-model-networkmap:property-type";
+ }
+ }
+
+ choice "data" {
+ }
+ }
+ }
+ }
+ }
+
+ augment "/base:query/base:input/base:request" {
+ case "networkmap-request-data" {
+ uses "networkmap-request-data";
+ }
+ }
+
+ augment "/base:query/base:output/base:response" {
+ case "networkmap-response-data" {
+ uses "networkmap-response-data";
+ }
+ }
+
+ identity "address-type-ipv4" {
+ base "address-type-base";
+ description
+ "Address type for IPv4";
+ }
+
+ identity "address-type-ipv6" {
+ base "address-type-base";
+ description
+ "Address type for IPv6";
+ }
+
+ augment "/base:query/base:output/base:response/networkmap-response-data/network-map/partition/property/data" {
+ case ipv4 {
+ leaf-list "ipv4" {
+ type ietf-inet:ipv4-prefix;
+ }
+ }
+
+ case ipv6 {
+ leaf-list "ipv6" {
+ type ietf-inet:ipv6-prefix;
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University 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.core</groupId>
+ <artifactId>alto-service-model-networkmap-artifacts</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-networkmap-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-networkmap-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-networkmap-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"?>
+<!--
+Copyright © 2015 Yale University 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">
+ <parent>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-networkmap-features</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <properties>
+ <mdsal.model.version>0.8.0-SNAPSHOT</mdsal.model.version>
+ <mdsal.version>1.3.0-SNAPSHOT</mdsal.version>
+ <restconf.version>1.3.0-SNAPSHOT</restconf.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
+ <dlux.version>0.3.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>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <classifier>features</classifier>
+ <version>${yangtools.version}</version>
+ <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>
+ <version>${mdsal.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>features-restconf</artifactId>
+ <classifier>features</classifier>
+ <version>${restconf.version}</version>
+ <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-service-model-networkmap-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-networkmap-impl</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-networkmap-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-base-features</artifactId>
+ <classifier>features</classifier>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-base-api</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 © 2015 Yale University 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-service-model-networkmap-${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/${yangtools.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.mdsal.model/features-mdsal-model/${mdsal.model.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.netconf/features-restconf/${restconf.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.dlux/features-dlux/${dlux.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.alto.core/alto-service-model-base-features/${project.version}/xml/features</repository>
+
+ <feature name='odl-alto-service-model-networkmap-api' version='${project.version}' description='OpenDaylight :: alto-service-model-networkmap :: api'>
+ <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
+ <feature version='${project.version}'>odl-alto-service-model-base</feature>
+ <bundle>mvn:org.opendaylight.alto.core/alto-service-model-networkmap-api/${project.version}</bundle>
+ </feature>
+
+ <feature name='odl-alto-service-model-networkmap' version='${project.version}' description='OpenDaylight :: alto-service-model-networkmap'>
+ <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
+ <feature version='${project.version}'>odl-alto-service-model-networkmap-api</feature>
+ <bundle>mvn:org.opendaylight.alto.core/alto-service-model-networkmap-impl/${project.version}</bundle>
+ <configfile finalname="${configfile.directory}/alto-service-model-networkmap.xml">mvn:org.opendaylight.alto.core/alto-service-model-networkmap-impl/${project.version}/xml/config</configfile>
+ </feature>
+
+ <feature name='odl-alto-service-model-networkmap-rest' version='${project.version}' description='OpenDaylight :: alto-service-model-networkmap :: REST'>
+ <feature version="${project.version}">odl-alto-service-model-networkmap</feature>
+ <feature version="${restconf.version}">odl-restconf</feature>
+ </feature>
+
+ <feature name='odl-alto-service-model-networkmap-ui' version='${project.version}' description='OpenDaylight :: alto-service-model-networkmap :: UI'>
+ <feature version="${project.version}">odl-alto-service-model-networkmap-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>
+
+</features>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Yale University 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">
+
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-networkmap-impl</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-base-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-resourcepool-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-networkmap-api</artifactId>
+ <version>${project.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
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+ <required-capabilities>
+ <capability>urn:opendaylight:alto:service:model:test:networkmap?module=alto-networkmap-test-impl&revision=2015-10-21</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
+ </required-capabilities>
+ <configuration>
+
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+ <type xmlns:prefix="urn:opendaylight:alto:service:model:test:networkmap">prefix:alto-model-networkmap-test</type>
+ <name>alto-networkmap-test</name>
+ <broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
+ <name>binding-osgi-broker</name>
+ </broker>
+ </module>
+ </modules>
+ </data>
+ </configuration>
+</snapshot>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata modelVersion="1.1.0">
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-networkmap-impl</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <localCopy>true</localCopy>
+ </snapshot>
+ <lastUpdated>20151028073152</lastUpdated>
+ <snapshotVersions>
+ <snapshotVersion>
+ <classifier>config</classifier>
+ <extension>xml</extension>
+ <value>0.2.0-SNAPSHOT</value>
+ <updated>20151028073152</updated>
+ </snapshotVersion>
+ </snapshotVersions>
+ </versioning>
+</metadata>
--- /dev/null
+/*
+ * Copyright © 2015 Yale University 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.core.impl.networkmap.test;
+
+import java.util.concurrent.Future;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.AddResourceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.AltoResourcepoolService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.ResourcePool;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.ServiceContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.resource.pool.Resource;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.resource.pool.ResourceBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.resource.pool.ResourceKey;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.types.rev150921.PidName;
+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.AddressTypeBase;
+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.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.ResourceTypeNetworkmap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.request.data.NetworkmapFilter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.response.data.NetworkMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.response.data.network.map.Partition;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.response.data.network.map.PartitionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.response.data.network.map.partition.Property;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.response.data.network.map.partition.PropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.input.request.NetworkmapRequestData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.NetworkmapResponseDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.networkmap.response.data.network.map.partition.property.data.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.networkmap.response.data.network.map.partition.property.data.Ipv6Builder;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.rev151021.AltoModelBaseService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.rev151021.QueryInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.rev151021.QueryOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.rev151021.QueryOutputBuilder;
+
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AltoNetworkmapProvider implements BindingAwareProvider, AutoCloseable, AltoModelBaseService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AltoNetworkmapProvider.class);
+
+ private DataBroker m_dataBrokerService = null;
+ private RoutedRpcRegistration<AltoModelBaseService> m_serviceReg = null;
+ private AltoResourcepoolService m_resourcepoolService = null;
+
+ private static final ResourceId TEST_NETWORKMAP_RID = new ResourceId("test-model-networkmap");
+ private InstanceIdentifier<Resource> m_testIID = null;
+
+ protected InstanceIdentifier<Resource> getResourceIID(ResourceId rid) {
+ ResourceKey key = new ResourceKey(rid);
+ return InstanceIdentifier.builder(ResourcePool.class).child(Resource.class, key).build();
+ }
+
+ @Override
+ public void onSessionInitiated(ProviderContext session) {
+ LOG.info("AltoModelNetworkProvider Session Initiated");
+
+ m_dataBrokerService = session.getSALService(DataBroker.class);
+ m_serviceReg = session.addRoutedRpcImplementation(AltoModelBaseService.class, this);
+
+ ResourceBuilder builder = new ResourceBuilder();
+ builder.setResourceId(TEST_NETWORKMAP_RID).setType(ResourceTypeNetworkmap.class);
+
+ AddResourceInputBuilder inputBuilder = new AddResourceInputBuilder();
+ inputBuilder.fieldsFrom(builder.build());
+
+ try {
+ AltoResourcepoolService resourcepool;
+ resourcepool = session.getRpcService(AltoResourcepoolService.class);
+
+ RpcResult<Void> result;
+ result = resourcepool.addResource(inputBuilder.build()).get();
+
+ assert result.isSuccessful();
+
+ m_testIID = getResourceIID(TEST_NETWORKMAP_RID);
+ m_serviceReg.registerPath(ServiceContext.class, m_testIID);
+ } catch (Exception e) {
+ }
+ }
+
+ @Override
+ public void close() throws Exception {
+ LOG.info("AltoModelBaseProvider Closed");
+ }
+
+ @Override
+ public Future<RpcResult<QueryOutput>> query(QueryInput input) {
+ if (!input.getType().equals(ResourceTypeNetworkmap.class)) {
+ return RpcResultBuilder.<QueryOutput>failed().buildFuture();
+ }
+ NetworkmapRequestData request = (NetworkmapRequestData)input.getRequest();
+ NetworkmapFilter filter = request.getNetworkmapFilter();
+
+ List<PidName> pids = filter.getPid();
+ List<Class<? extends AddressTypeBase>> types = filter.getAddressType();
+
+ int index = 0;
+ LinkedList<Partition> partitionList = new LinkedList<Partition>();
+ for (PidName pid: pids) {
+ ++index;
+
+ LinkedList<Property> propertyList = new LinkedList<Property>();
+ if (types.contains(AddressTypeIpv4.class)) {
+ LinkedList<Ipv4Prefix> ipv4List = new LinkedList<Ipv4Prefix>();
+ ipv4List.add(new Ipv4Prefix("192.168." + index + ".0/24"));
+
+ Ipv4Builder v4Builder = new Ipv4Builder();
+ v4Builder.setIpv4(ipv4List);
+
+ PropertyBuilder v4PropertyBuilder = new PropertyBuilder();
+ v4PropertyBuilder.setPropertyType(AddressTypeIpv4.class).setData(v4Builder.build());
+ propertyList.add(v4PropertyBuilder.build());
+ }
+ if (types.contains(AddressTypeIpv6.class)) {
+ LinkedList<Ipv6Prefix> ipv6List = new LinkedList<Ipv6Prefix>();
+ ipv6List.add(new Ipv6Prefix("2001:b8:ca2:" + index + "::0/64"));
+
+ Ipv6Builder v6Builder = new Ipv6Builder();
+ v6Builder.setIpv6(ipv6List);
+
+ PropertyBuilder v6PropertyBuilder = new PropertyBuilder();
+ v6PropertyBuilder.setPropertyType(AddressTypeIpv6.class).setData(v6Builder.build());
+ propertyList.add(v6PropertyBuilder.build());
+ }
+
+ PartitionBuilder partitionBuilder = new PartitionBuilder();
+ partitionBuilder.setProperty(propertyList).setPid(pid);
+
+ partitionList.add(partitionBuilder.build());
+ }
+
+ NetworkMapBuilder nmBuilder = new NetworkMapBuilder();
+ nmBuilder.setPartition(partitionList);
+
+ NetworkmapResponseDataBuilder nmrBuilder = new NetworkmapResponseDataBuilder();
+ nmrBuilder.setNetworkMap(nmBuilder.build());
+
+ QueryOutputBuilder builder = new QueryOutputBuilder();
+
+ builder.setType(ResourceTypeNetworkmap.class).setResponse(nmrBuilder.build());
+ return RpcResultBuilder.<QueryOutput>success(builder.build()).buildFuture();
+ }
+
+}
--- /dev/null
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.test.networkmap.rev151021;
+
+import org.opendaylight.alto.core.impl.networkmap.test.AltoNetworkmapProvider;
+
+public class AltoNetworkmapModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.test.networkmap.rev151021.AbstractAltoNetworkmapModule {
+ public AltoNetworkmapModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public AltoNetworkmapModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.test.networkmap.rev151021.AltoNetworkmapModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ AltoNetworkmapProvider provider = new AltoNetworkmapProvider();
+
+ getBrokerDependency().registerProvider(provider);
+ return provider;
+ }
+
+}
--- /dev/null
+/*
+* Generated file
+*
+* Generated from: yang module name: alto-networkmap-test-impl yang module local name: alto-model-networkmap-test
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Oct 28 11:47:28 CST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.test.networkmap.rev151021;
+public class AltoNetworkmapModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.test.networkmap.rev151021.AbstractAltoNetworkmapModuleFactory {
+
+}
--- /dev/null
+module alto-networkmap-test-impl {
+ yang-version 1;
+ namespace "urn:opendaylight:alto:service:model:test:networkmap";
+ prefix "alto-model-networkmap-test-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+
+ description
+ "Service definition for networkmap project";
+
+ revision "2015-10-21" {
+ description
+ "Initial revision";
+ }
+
+ identity alto-model-networkmap-test {
+ base config:module-type;
+ config:java-name-prefix AltoNetworkmap;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case alto-model-networkmap-test-impl {
+ when "/config:modules/config:module/config:type = 'alto-model-networkmap-test'";
+ container broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-broker-osgi-registry;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2015 Yale University 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.yang.gen.v1.urn.opendaylight.alto.service.model.test.networkmap.rev151021;
+
+import org.junit.Test;
+
+public class AltoNetworkmapModuleFactoryTest {
+ @Test
+ public void testFactoryConstructor() {
+ // ensure no exceptions on construction
+ new AltoNetworkmapModuleFactory();
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2015 Yale University 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.yang.gen.v1.urn.opendaylight.alto.service.model.test.networkmap.rev151021;
+
+import org.junit.Test;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.JmxAttribute;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.alto.core.impl.networkmap.test.AltoNetworkmapProvider;
+
+import javax.management.ObjectName;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class AltoNetworkmapModuleTest {
+ @Test
+ public void testCustomValidation() {
+ AltoNetworkmapModule module = new AltoNetworkmapModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));
+
+ // ensure no exceptions on validation
+ // currently this method is empty
+ module.customValidation();
+ }
+
+ @Test
+ public void testCreateInstance() throws Exception {
+ // configure mocks
+ DependencyResolver dependencyResolver = mock(DependencyResolver.class);
+ BindingAwareBroker broker = mock(BindingAwareBroker.class);
+ when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);
+
+ // create instance of module with injected mocks
+ AltoNetworkmapModule module = new AltoNetworkmapModule(mock(ModuleIdentifier.class), dependencyResolver);
+
+ // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
+ AutoCloseable closeable = module.getInstance();
+
+ // verify that the module registered the returned provider with the broker
+ verify(broker).registerProvider((AltoNetworkmapProvider)closeable);
+
+ // ensure no exceptions on close
+ closeable.close();
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University 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">
+
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-it-parent</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-networkmap-it</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <skipITs>false</skipITs>
+ <karaf.distro.groupId>org.opendaylight.alto.core</karaf.distro.groupId>
+ <karaf.distro.artifactId>alto-service-model-networkmap-karaf</karaf.distro.artifactId>
+ <karaf.distro.version>0.2.0-SNAPSHOT</karaf.distro.version>
+ <karaf.distro.type>zip</karaf.distro.type>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-networkmap-features</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
--- /dev/null
+/*
+ * Copyright © 2015 Yale University 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.core.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 AltoNetworkmapIT extends AbstractMdsalTestBase {
+ private static final Logger LOG = LoggerFactory.getLogger(AltoNetworkmapIT.class);
+
+ @Override
+ public String getModuleName() {
+ return "alto-model-networkmap-test";
+ }
+
+ @Override
+ public String getInstanceName() {
+ return "alto-networkmap-test";
+ }
+
+ @Override
+ public MavenUrlReference getFeatureRepo() {
+ return maven()
+ .groupId("org.opendaylight.alto.core")
+ .artifactId("alto-service-model-networkmap-features")
+ .classifier("features")
+ .type("xml")
+ .versionAsInProject();
+ }
+
+ @Override
+ public String getFeatureName() {
+ return "odl-alto-service-model-networkmap-ui";
+ }
+
+ @Override
+ public Option getLoggingOption() {
+ Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+ logConfiguration(AltoNetworkmapIT.class),
+ LogLevel.INFO.name());
+ option = composite(option, super.getLoggingOption());
+ return option;
+ }
+
+ @Test
+ public void testnetworkmapFeatureLoad() {
+ Assert.assertTrue(true);
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University 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">
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>karaf-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-networkmap-karaf</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <properties>
+ <karaf.localFeature>odl-alto-service-model-networkmap-ui</karaf.localFeature>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-service-model-networkmap-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-service-model-networkmap-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <!-- DO NOT install or deploy the karaf artifact -->
+ <build>
+ <plugins>
+ <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 © 2015 Yale University 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">
+
+ <parent>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>odlparent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-networkmap-aggregator</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <name>alto-service-model-networkmap</name>
+ <packaging>pom</packaging>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <profiles>
+ <profile>
+ <id>minimal</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>api</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>
+ </profiles>
+
+ <!-- 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>
</prerequisites>
<modules>
<module>model-base</module>
+ <module>model-networkmap</module>
</modules>
<!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
<build>