.metadata
*.swp
**/*.swp
+**/*.checkstyle
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 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>
-
- <parent>
- <groupId>org.opendaylight.alto</groupId>
- <artifactId>alto-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../</relativePath>
- </parent>
-
- <groupId>org.opendaylight.alto</groupId>
- <artifactId>alto-artifacts</artifactId>
- <packaging>pom</packaging>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>alto-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>alto-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>alto-features</artifactId>
- <version>${project.version}</version>
- <classifier>features</classifier>
- <type>xml</type>
- </dependency>
- </dependencies>
- </dependencyManagement>
-</project>
<relativePath>..</relativePath>
</parent>
- <properties>
- <checkstyle.skip>true</checkstyle.skip>
- </properties>
-
<groupId>org.opendaylight.alto</groupId>
<artifactId>alto-commons</artifactId>
<packaging>bundle</packaging>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
-
<executions>
<execution>
<phase>process-sources</phase>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
</build>
<dependencies>
-
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>alto-model</artifactId>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ </dependency>
</dependencies>
</project>
--- /dev/null
+package org.opendaylight.alto.commons.types.convertor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.EndpointAddressType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.PidName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ResourceId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.TagString;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroup;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupKey;
+
+import org.opendaylight.alto.commons.types.rfc7285.RFC7285Type;
+import org.opendaylight.alto.commons.types.model150404.ModelType;
+
+public class Model2RFCConvertor {
+
+ public static final String IPV4 = "ipv4";
+ public static final String IPV6 = "ipv6";
+
+}
--- /dev/null
+package org.opendaylight.alto.commons.types.convertor;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Arrays;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.EndpointAddressType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.PidName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ResourceId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.TagString;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroup;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupKey;
+
+import org.opendaylight.alto.commons.types.rfc7285.RFC7285Type;
+import org.opendaylight.alto.commons.types.model150404.ModelType;
+
+public class RFC2ModelConvertor {
+
+ public static final String IPV4 = "ipv4";
+ public static final String IPV6 = "ipv6";
+
+ public ModelType.NetworkMap convert(RFC7285Type.NetworkMap nmap) {
+ ResourceId rid = new ResourceId(nmap.meta.vtag.rid);
+ TagString tag = new TagString(nmap.meta.vtag.tag);
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map> mapData
+ = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map>(convert(nmap.map));
+ ModelType.NetworkMap result = (ModelType.NetworkMap)(new NetworkMapBuilder()
+ .setResourceId(rid)
+ .setTag(tag)
+ .setMap(mapData).build());
+ return result;
+ }
+
+ public List<ModelType.NetworkMapData> convert(Map<String, RFC7285Type.Endpoint.AddressGroup> mapData) {
+ List<ModelType.NetworkMapData> result = new ArrayList<ModelType.NetworkMapData>();
+ for (Map.Entry<String, RFC7285Type.Endpoint.AddressGroup> entry: mapData.entrySet()) {
+ String pid = entry.getKey();
+ RFC7285Type.Endpoint.AddressGroup addresses = entry.getValue();
+
+ result.add(convert(pid, addresses));
+ }
+ return result;
+ }
+
+ public ModelType.NetworkMapData convert(String pid, RFC7285Type.Endpoint.AddressGroup data) {
+ PidName _pid = new PidName(pid);
+ return (ModelType.NetworkMapData)new MapBuilder()
+ .setPid(_pid)
+ .setKey(new MapKey(_pid))
+ .setEndpointAddressGroup(convert(data))
+ .build();
+ }
+
+ public List<EndpointAddressGroup> convert(RFC7285Type.Endpoint.AddressGroup addressGroup) {
+ EndpointAddressGroup result[] = {
+ buildAddressGroup(EndpointAddressType.Enumeration.Ipv4, str2IpPrefix(addressGroup.ipv4)),
+ buildAddressGroup(EndpointAddressType.Enumeration.Ipv6, str2IpPrefix(addressGroup.ipv6)),
+ };
+
+ return Arrays.asList(result);
+ }
+
+ private EndpointAddressGroup buildAddressGroup(EndpointAddressType.Enumeration type, List<IpPrefix> prefixes) {
+ EndpointAddressType _type = new EndpointAddressType(type);
+ return new EndpointAddressGroupBuilder()
+ .setAddressType(_type)
+ .setEndpointPrefix(prefixes).build();
+ }
+
+ private List<IpPrefix> str2IpPrefix(List<String> ipList) {
+ List<IpPrefix> prefixList = new ArrayList<IpPrefix>();
+ for (String ip : ipList) {
+ prefixList.add(IpPrefixBuilder.getDefaultInstance(ip));
+ }
+ return prefixList;
+ }
+
+}
+++ /dev/null
-package org.opendaylight.alto.commons.types.mapper;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.alto.commons.types.rfc7285.AltoNetworkMap;
-import org.opendaylight.alto.commons.types.rfc7285.Endpoint;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefixBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.EndpointAddressType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.PidName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ResourceId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.TagString;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroup;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupKey;
-
-public class AltoYangMapper {
- public static final String IPV4 = "ipv4";
- public static final String IPV6 = "ipv6";
-
- public AltoYangMapper() {};
-
- public NetworkMap asNetworkMap(AltoNetworkMap base) {
- ResourceId rid = new ResourceId(base.meta.vtag.rid);
-
- NetworkMapBuilder networkMapBuilder = new NetworkMapBuilder();
- networkMapBuilder.setTag(new TagString(base.meta.vtag.tag));
- networkMapBuilder.setResourceId(rid);
- networkMapBuilder.setKey(new NetworkMapKey(rid));
- networkMapBuilder.setMap(asNetworkMapDataList(base.map));
-
- return networkMapBuilder.build();
- }
-
- public List<Map> asNetworkMapDataList(java.util.Map<String, Endpoint.AddressGroup> mapData) {
- List<Map> resultMapData = new ArrayList<Map>();
- for (String key : mapData.keySet()) {
- resultMapData.add(asNetworkMapData(key, mapData.get(key)));
- }
- return resultMapData;
- }
-
- public Map asNetworkMapData(String key, Endpoint.AddressGroup data) {
- PidName pid = new PidName(key);
- return new MapBuilder()
- .setPid(pid)
- .setKey(new MapKey(pid))
- .setEndpointAddressGroup(asEndpointAddressGroupList(data))
- .build();
- }
-
- public List<EndpointAddressGroup> asEndpointAddressGroupList(Endpoint.AddressGroup addressGroup) {
- List<EndpointAddressGroup> endpointAddressGroup = new ArrayList<EndpointAddressGroup>();
- java.util.Map<String, Object> addressGroupMap = addressGroup.any();
- for (String key : addressGroupMap.keySet()) {
- endpointAddressGroup.add(constructEndpointAddressGroupElement(key, addressGroupMap));
- }
- return endpointAddressGroup;
- }
-
- @SuppressWarnings("unchecked")
- private EndpointAddressGroup constructEndpointAddressGroupElement(String key, java.util.Map<String, Object> addressGroupMap){
- EndpointAddressGroupBuilder addressGroupBuilder = new EndpointAddressGroupBuilder();
- EndpointAddressType type = null;
- if (IPV4.equals(key)) {
- type = new EndpointAddressType(EndpointAddressType.Enumeration.Ipv4);
- } else if (IPV6.equals(key)) {
- type = new EndpointAddressType(EndpointAddressType.Enumeration.Ipv6);
- }
-
- addressGroupBuilder.setAddressType(type);
- addressGroupBuilder.setKey(new EndpointAddressGroupKey(type));
- addressGroupBuilder.setEndpointPrefix(constructIpPrefixList((List<String>)addressGroupMap.get(key)));
- return addressGroupBuilder.build();
- }
-
- private List<IpPrefix> constructIpPrefixList(List<String> ipList) {
- List<IpPrefix> ipPrefixList = new ArrayList<IpPrefix>();
- for (String ip : ipList) {
- ipPrefixList.add(IpPrefixBuilder.getDefaultInstance(ip));
- }
- return ipPrefixList;
- }
-}
--- /dev/null
+package org.opendaylight.alto.commons.types.model150404;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.alto.commons.types.rfc7285.RFC7285Type;
+import org.opendaylight.alto.commons.types.convertor.RFC2ModelConvertor;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.EndpointAddressType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.PidName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ResourceId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.TagString;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroup;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupKey;
+
+public class JSONMapper {
+
+ private RFC7285Type.JSONMapper rfc7285Mapper = new RFC7285Type.JSONMapper();
+ private RFC2ModelConvertor convertor = new RFC2ModelConvertor();
+
+ public NetworkMap asNetworkMap(String rfc7285json) throws Exception {
+ return (NetworkMap)convertor.convert((RFC7285Type.NetworkMap)rfc7285Mapper.asNetworkMap(rfc7285json));
+ }
+
+}
--- /dev/null
+package org.opendaylight.alto.commons.types.model150404;
+
+public class ModelType {
+
+ public static interface NetworkMap
+ extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMap {}
+
+ public static interface NetworkMapData
+ extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map {
+ }
+
+ public static class JSONMapper
+ extends org.opendaylight.alto.commons.types.model150404.JSONMapper {}
+}
+++ /dev/null
-package org.opendaylight.alto.commons.types.rfc7285;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.MapKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.PidName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ResourceId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.TagString;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Network Map: defined in RFC 7285 section 11.2.1
- * */
-public class AltoNetworkMap {
-
- public AltoNetworkMap() {}
-
- public AltoNetworkMap(NetworkMap base) {
- this.meta = new AltoNetworkMap.Meta(
- new VersionTag(base.getResourceId().getValue(), base.getTag().getValue()));
-
- this.map = new LinkedHashMap<String, Endpoint.AddressGroup>();
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map> baseMaps = base.getMap();
- for (org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map map : baseMaps) {
- String key = map.getKey().getPid().getValue();
- this.map.put(key, new Endpoint.AddressGroup(map.getEndpointAddressGroup()));
- }
- }
-
- public static class Meta extends Extensible {
- public Meta() {}
-
- public Meta(VersionTag vtag) {
- this.vtag = vtag;
- }
-
- @JsonProperty("vtag")
- public VersionTag vtag;
-
- }
-
- /**
- * used for filtered-network-map, RFC7285 secion 11.3.1
- * */
- public static class Filter {
-
- @JsonProperty("pids")
- public List<String> pids;
-
- }
-
- @JsonProperty("meta")
- public Meta meta;
-
- @JsonProperty("network-map")
- public Map<String, Endpoint.AddressGroup> map
- = new LinkedHashMap<String, Endpoint.AddressGroup>();
-
- public NetworkMap asYangNetworkMap() {
- ResourceId rid = new ResourceId(this.meta.vtag.rid);
- return new NetworkMapBuilder()
- .setTag(new TagString(this.meta.vtag.tag))
- .setResourceId(rid)
- .setKey(new NetworkMapKey(rid))
- .setMap(asNetworkMapDataList(this.map))
- .build();
- }
-
- private List<org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map> asNetworkMapDataList(
- java.util.Map<String, Endpoint.AddressGroup> mapData) {
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map> resultMapData =
- new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map>();
- for (String key : mapData.keySet()) {
- resultMapData.add(asNetworkMapData(key, mapData.get(key)));
- }
- return resultMapData;
- }
-
- private org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.network.map.Map asNetworkMapData(
- String key, Endpoint.AddressGroup data) {
- PidName pid = new PidName(key);
- return new MapBuilder()
- .setPid(pid)
- .setKey(new MapKey(pid))
- .setEndpointAddressGroup(data.asYangEndpointAddressGroupList())
- .build();
- }
-
-}
public class CostType {
- @JsonProperty("cost-metric")
- public String metric;
-
@JsonProperty("cost-mode")
public String mode;
+ @JsonProperty("cost-metric")
+ public String metric;
+
@JsonProperty("description")
public String description;
+ public CostType() {
+ }
+
+ public CostType(String mode, String metric) {
+ this.mode = mode;
+ this.metric = metric;
+ }
+
+ public CostType(String mode, String metric, String description) {
+ this.mode = mode;
+ this.metric = metric;
+ this.description = description;
+ }
+
@Override
public int hashCode() {
String[] members = { metric, mode };
package org.opendaylight.alto.commons.types.rfc7285;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.LinkedHashMap;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefixBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.EndpointAddressType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroup;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.endpoint.address.group.EndpointAddressGroupKey;
-
public class Endpoint {
-
- public static class AddressGroup extends Extensible {
-
- @JsonIgnore
- public static final String IPV4_LABEL = "ipv4";
-
- @JsonIgnore
- public static final String IPV6_LABEL = "ipv6";
-
- @JsonProperty(IPV4_LABEL)
- public List<String> ipv4 = new ArrayList<String>();
-
- @JsonProperty(IPV6_LABEL)
- public List<String> ipv6 = new ArrayList<String>();
-
- public AddressGroup() {}
-
- public AddressGroup(List<EndpointAddressGroup> base) {
- for (EndpointAddressGroup group : base) {
- switch (group.getAddressType().getEnumeration()) {
- case Ipv4:
- this.ipv4 = asStringIpPrefixList(EndpointAddressType.Enumeration.Ipv4, group.getEndpointPrefix());
- break;
- case Ipv6:
- this.ipv6 = asStringIpPrefixList(EndpointAddressType.Enumeration.Ipv6, group.getEndpointPrefix());
- break;
- default:
- break;
- }
- }
- }
+ public static class AddressGroup extends Extensible {
- private List<String> asStringIpPrefixList(EndpointAddressType.Enumeration type, List<IpPrefix> base) {
- List<String> addressPrefixes = new ArrayList<String>();
- for (IpPrefix prefix : base) {
- switch (type) {
- case Ipv4:
- addressPrefixes.add(prefix.getIpv4Prefix().getValue());
- break;
- case Ipv6:
- addressPrefixes.add(prefix.getIpv6Prefix().getValue());
- break;
- default:
- break;
- }
- }
- return addressPrefixes;
- }
-
- public List<EndpointAddressGroup> asYangEndpointAddressGroupList() {
- List<EndpointAddressGroup> endpointAddressGroup = new ArrayList<EndpointAddressGroup>();
- if (this.ipv4.size() > 0) {
- endpointAddressGroup.add(asYangEndpointAddressGroup(IPV4_LABEL, this.ipv4));
- }
- if (this.ipv6.size() > 0) {
- endpointAddressGroup.add(asYangEndpointAddressGroup(IPV6_LABEL, this.ipv6));
- }
- return endpointAddressGroup;
- }
+ @JsonIgnore
+ public static final String IPV4_LABEL = "ipv4";
- private EndpointAddressGroup asYangEndpointAddressGroup(String key, List<String> ipList){
- EndpointAddressType type = null;
- if (IPV4_LABEL.equals(key)) {
- type = new EndpointAddressType(EndpointAddressType.Enumeration.Ipv4);
- } else if (IPV6_LABEL.equals(key)) {
- type = new EndpointAddressType(EndpointAddressType.Enumeration.Ipv6);
- }
-
- return new EndpointAddressGroupBuilder().setAddressType(type)
- .setKey(new EndpointAddressGroupKey(type))
- .setEndpointPrefix(asYangIpPrefix(ipList))
- .build();
- }
+ @JsonIgnore
+ public static final String IPV6_LABEL = "ipv6";
+
+ @JsonProperty(IPV4_LABEL)
+ public List<String> ipv4 = new ArrayList<String>();
+
+ @JsonProperty(IPV6_LABEL)
+ public List<String> ipv6 = new ArrayList<String>();
- private List<IpPrefix> asYangIpPrefix(List<String> ipList) {
- List<IpPrefix> ipPrefixList = new ArrayList<IpPrefix>();
- for (String ip : ipList) {
- ipPrefixList.add(IpPrefixBuilder.getDefaultInstance(ip));
- }
- return ipPrefixList;
}
- }
- public static class PropertyRequest {
+ public static class PropertyRequest {
- @JsonProperty("properties")
- public List<String> properties;
+ @JsonProperty("properties")
+ public List<String> properties;
- @JsonProperty("endpoints")
- public List<String> endpoints;
- }
+ @JsonProperty("endpoints")
+ public List<String> endpoints;
+ }
- public static class PropertyRespond {
+ public static class PropertyResponse {
- public static class Meta extends Extensible {
+ public static class Meta extends Extensible {
- @JsonProperty("dependent-vtags")
- public List<VersionTag> netmap_tags;
+ @JsonProperty("dependent-vtags")
+ public List<VersionTag> netmap_tags;
- }
+ }
- @JsonProperty("meta")
- public Meta meta;
+ @JsonProperty("meta")
+ public Meta meta;
- @JsonProperty("endpoint-properties")
- public Map<String, Map<String, Object>> answer = new LinkedHashMap<String, Map<String, Object>>();
- }
+ @JsonProperty("endpoint-properties")
+ public Map<String, Map<String, Object>> answer
+ = new LinkedHashMap<String, Map<String, Object>>();
+ }
- public static class CostRequest {
+ public static class CostRequest {
- @JsonProperty("cost-type")
- public CostType costType;
+ @JsonProperty("cost-type")
+ public CostType costType;
- @JsonProperty("endpoints")
- public QueryPairs endpoints;
- }
+ @JsonProperty("endpoints")
+ public QueryPairs endpoints;
+ }
- public static class CostRespond {
+ public static class CostResponse {
- public static class Meta extends Extensible {
+ public static class Meta extends Extensible {
- @JsonProperty("cost-type")
- public CostType costType;
+ @JsonProperty("cost-type")
+ public CostType costType;
- }
+ }
- @JsonProperty("meta")
- public Meta meta;
+ @JsonProperty("meta")
+ public Meta meta;
- @JsonProperty("endpoint-cost-map")
- public Map<String, Map<String, Object>> answer = new LinkedHashMap<String, Map<String, Object>>();
- }
+ @JsonProperty("endpoint-cost-map")
+ public Map<String, Map<String, Object>> answer
+ = new LinkedHashMap<String, Map<String, Object>>();
+ }
}
private static final String VALID_CHARSET_WITH_DOT = VALID_CHARSET + "\\.";
private static final Pattern VALID_ID_PATTERN_WITH_DOT
= Pattern.compile("^["+VALID_CHARSET_WITH_DOT+"]{1,64}$");
+ private static final String VALID_TAG_CHARSET = "!-~";
+ private static final Pattern VALID_TAG_PATTERN
+ = Pattern.compile("^["+VALID_TAG_CHARSET+"]{1,64}$}");
public static boolean validId(String id) {
return VALID_ID_PATTERN.matcher(id).matches();
return validIdWithDots(id);
}
+ /**
+ * RFC 7285 section 10.3
+ * */
+ public static boolean validTag(String tag) {
+ return VALID_TAG_PATTERN.matcher(tag).matches();
+ }
/**
* RFC 7285 section 10.8.1
* */
-package org.opendaylight.alto.commons.types.mapper;
-
-import org.opendaylight.alto.commons.types.rfc7285.AltoNetworkMap;
-import org.opendaylight.alto.commons.types.rfc7285.CostMap;
-import org.opendaylight.alto.commons.types.rfc7285.CostType;
-import org.opendaylight.alto.commons.types.rfc7285.Endpoint;
-import org.opendaylight.alto.commons.types.rfc7285.Extensible;
-import org.opendaylight.alto.commons.types.rfc7285.IRD;
-import org.opendaylight.alto.commons.types.rfc7285.VersionTag;
+package org.opendaylight.alto.commons.types.rfc7285;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
return mapper.readValue(json, Endpoint.PropertyRequest.class);
}
- public Endpoint.PropertyRespond asPropertyRespond(String json) throws Exception {
- return mapper.readValue(json, Endpoint.PropertyRespond.class);
+ public Endpoint.PropertyResponse asPropertyResponse(String json) throws Exception {
+ return mapper.readValue(json, Endpoint.PropertyResponse.class);
}
public Endpoint.CostRequest asCostRequest(String json) throws Exception {
return mapper.readValue(json, Endpoint.CostRequest.class);
}
- public Endpoint.CostRespond asCostRespond(String json) throws Exception {
- return mapper.readValue(json, Endpoint.CostRespond.class);
+ public Endpoint.CostResponse asCostResponse(String json) throws Exception {
+ return mapper.readValue(json, Endpoint.CostResponse.class);
}
public CostMap asCostMap(String json) throws Exception {
return mapper.readValue(json, IRD.class);
}
- public AltoNetworkMap asNetworkMap(String json) throws Exception {
- return mapper.readValue(json, AltoNetworkMap.class);
+ public NetworkMap asNetworkMap(String json) throws Exception {
+ return mapper.readValue(json, NetworkMap.class);
+ }
+
+ public NetworkMap.Filter asNetworkMapFilter(String json) throws Exception {
+ return mapper.readValue(json, NetworkMap.Filter.class);
+ }
+
+ public CostMap.Filter asCostMapFilter(String json) throws Exception {
+ return mapper.readValue(json, CostMap.Filter.class);
}
public VersionTag asVersionTag(String json) throws Exception {
--- /dev/null
+package org.opendaylight.alto.commons.types.rfc7285;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Network Map: defined in RFC 7285 section 11.2.1
+ * */
+public class NetworkMap {
+
+ public static class Meta extends Extensible {
+
+ @JsonProperty("vtag")
+ public VersionTag vtag;
+
+ }
+
+ /**
+ * used for filtered-network-map, RFC7285 secion 11.3.1
+ * */
+ public static class Filter {
+
+ @JsonProperty("pids")
+ public List<String> pids;
+
+ }
+
+ @JsonProperty("meta")
+ public Meta meta;
+
+ @JsonProperty("network-map")
+ public Map<String, Endpoint.AddressGroup> map
+ = new LinkedHashMap<String, Endpoint.AddressGroup>();
+}
--- /dev/null
+package org.opendaylight.alto.commons.types.rfc7285;
+
+public class RFC7285Type {
+
+ public static class NetworkMap
+ extends org.opendaylight.alto.commons.types.rfc7285.NetworkMap {}
+
+ public static class CostMap
+ extends org.opendaylight.alto.commons.types.rfc7285.CostMap {}
+
+ public static class CostType
+ extends org.opendaylight.alto.commons.types.rfc7285.CostType {}
+
+ public static class Endpoint
+ extends org.opendaylight.alto.commons.types.rfc7285.Endpoint {}
+
+ public static class IRD
+ extends org.opendaylight.alto.commons.types.rfc7285.IRD {}
+
+ public static class MediaType
+ extends org.opendaylight.alto.commons.types.rfc7285.MediaType {}
+
+ public static class JSONMapper
+ extends org.opendaylight.alto.commons.types.rfc7285.JSONMapper {}
+
+ public static class VersionTag
+ extends org.opendaylight.alto.commons.types.rfc7285.VersionTag {}
+}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 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.5.0-SNAPSHOT</version>
- <relativePath/>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.opendaylight.alto</groupId>
- <artifactId>alto-karaf</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <name>${project.artifactId}</name>
- <prerequisites>
- <maven>3.1.1</maven>
- </prerequisites>
- <properties>
- <karaf.localFeature>odl-alto-provider-ui</karaf.localFeature>
- </properties>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>alto-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-features</artifactId>
- <classifier>features</classifier>
- <type>xml</type>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-</project>
<?xml version="1.0" encoding="UTF-8"?>
<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.alto</groupId>
- <artifactId>alto-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../</relativePath>
- </parent>
+ 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.alto</groupId>
+ <artifactId>alto-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
- <artifactId>alto-model</artifactId>
- <packaging>bundle</packaging>
+ <artifactId>alto-model</artifactId>
+ <packaging>bundle</packaging>
- <properties>
- <jmxGeneratorPath>${project.build.directory}/generated-sources/config</jmxGeneratorPath>
- </properties>
+ <properties>
+ <jmxGeneratorPath>${project.build.directory}/generated-sources/config</jmxGeneratorPath>
+ </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
- <executions>
- <execution>
- <phase>process-sources</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <failsOnError>true</failsOnError>
- <configLocation>controller/checkstyle.xml</configLocation>
- <consoleOutput>true</consoleOutput>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <sourceDirectory>${project.basedir}</sourceDirectory>
- <includes>**\/*.yang</includes>
- <excludes>**\/target\/,**\/bin\/,**\/third-party,**\/yang-gen-sal</excludes>
- </configuration>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/generated-sources/sal</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>checkstyle</artifactId>
- <version>${controller.checkstyle.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${compiler.version}</version>
- <inherited>true</inherited>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <failsOnError>true</failsOnError>
+ <configLocation>controller/checkstyle.xml</configLocation>
+ <consoleOutput>true</consoleOutput>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <sourceDirectory>${project.basedir}</sourceDirectory>
+ <includes>**\/*.yang</includes>
+ <excludes>**\/target\/,**\/bin\/,**\/third-party,**\/yang-gen-sal</excludes>
+ </configuration>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.opendaylight.yang.gen.v1.urn.opendaylight.alto.*;
- </Export-Package>
- <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
- </instructions>
- </configuration>
- </plugin>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>${controller.checkstyle.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>generate-sources</goal>
- </goals>
- <configuration>
- <codeGenerators>
- <generator>
- <codeGeneratorClass>
- org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- </codeGeneratorClass>
- <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
- <additionalConfiguration>
- <namespaceToPackage1>
- urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
- </namespaceToPackage1>
- </additionalConfiguration>
- </generator>
- <generator>
- <codeGeneratorClass>
- org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
- </codeGeneratorClass>
- <outputBaseDir>${project.build.directory}/generated-sources/sal</outputBaseDir>
- </generator>
- <generator>
- <codeGeneratorClass>
- org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl
- </codeGeneratorClass>
- <outputBaseDir>${project.build.directory}/site/models</outputBaseDir>
- </generator>
- </codeGenerators>
- <inspectDependencies>true</inspectDependencies>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-jmx-generator-plugin</artifactId>
- <version>0.3.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>maven-sal-api-gen-plugin</artifactId>
- <version>${yangtools.version}</version>
- <type>jar</type>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
- <dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>18.0</version>
- </dependency>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.opendaylight.yang.gen.v1.urn.opendaylight.alto.*;
+ </Export-Package>
+ <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+ </instructions>
+ </configuration>
+ </plugin>
- <dependency>
- <groupId>org.opendaylight.yangtools.model</groupId>
- <artifactId>ietf-inet-types</artifactId>
- <version>${ietf.model.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.model</groupId>
- <artifactId>ietf-yang-types-20130715</artifactId>
- <version>${ietf.yang.types.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>southbound-api</artifactId>
- <version>${ovsdb.southbound.version}</version>
- </dependency>
- </dependencies>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>
+ org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ </codeGeneratorClass>
+ <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+ <additionalConfiguration>
+ <namespaceToPackage1>
+ urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+ </namespaceToPackage1>
+ </additionalConfiguration>
+ </generator>
+ <generator>
+ <codeGeneratorClass>
+ org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
+ </codeGeneratorClass>
+ <outputBaseDir>${project.build.directory}/generated-sources/sal</outputBaseDir>
+ </generator>
+ <generator>
+ <codeGeneratorClass>
+ org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl
+ </codeGeneratorClass>
+ <outputBaseDir>${project.build.directory}/site/models</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>yang-jmx-generator-plugin</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
+ <version>${ietf.model.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools.model</groupId>
+ <artifactId>ietf-yang-types-20130715</artifactId>
+ <version>${ietf.yang.types.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>southbound-api</artifactId>
+ <version>${ovsdb.southbound.version}</version>
+ </dependency>
+ </dependencies>
</project>
<version>1.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
- <groupId>org.opendaylight.alto</groupId>
<artifactId>alto-northbound</artifactId>
- <version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<build>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
org.opendaylight.yang.gen.v1.urn.opendaylight.alto.*,
- org.opendaylight.alto.services,
+ org.opendaylight.alto.services.ext.fake,
+ org.opendaylight.alto.services.api.rfc7285,
org.opendaylight.alto.commons.*,
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924,
org.apache.commons.logging,
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
-
<executions>
<execution>
<phase>process-sources</phase>
</dependency>
</dependencies>
</plugin>
-
</plugins>
</build>
<dependency>
<groupId>org.opendaylight.controller.thirdparty</groupId>
<artifactId>com.sun.jersey.jersey-servlet</artifactId>
- <version>${jersey.servlet.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<dependency>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>enunciate-core-annotations</artifactId>
- <version>${enunciate.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller.thirdparty</groupId>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>alto-services</artifactId>
+ <artifactId>service-api-rfc7285</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>services.ext.fake</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
package org.opendaylight.alto.northbound;
import javax.ws.rs.GET;
+import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
+import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
-import org.opendaylight.alto.commons.types.mapper.JSONMapper;
+import org.opendaylight.alto.commons.types.rfc7285.JSONMapper;
+import org.opendaylight.alto.commons.types.rfc7285.FormatValidator;
import org.opendaylight.alto.commons.types.rfc7285.MediaType;
-import org.opendaylight.alto.services.AltoService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.IRD;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ResourceId;
+import org.opendaylight.alto.commons.types.rfc7285.NetworkMap;
+import org.opendaylight.alto.commons.types.rfc7285.CostType;
+import org.opendaylight.alto.commons.types.rfc7285.IRD;
+import org.opendaylight.alto.commons.types.rfc7285.VersionTag;
+import org.opendaylight.alto.commons.types.rfc7285.CostMap;
+import org.opendaylight.alto.commons.types.rfc7285.Endpoint;
+
+import org.opendaylight.alto.services.api.rfc7285.AltoService;
+
+import org.opendaylight.alto.services.ext.fake.FakeAltoService;
+
+import org.opendaylight.alto.northbound.exception.AltoBasicException;
+import org.opendaylight.alto.northbound.exception.AltoBadFormatException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Path("/")
public class AltoNorthbound {
- private AltoService altoService = new AltoService();
- private JSONMapper mapper = new JSONMapper();
-
- @GET
- @Produces({ MediaType.ALTO_DIRECTORY, MediaType.ALTO_ERROR })
- public Response retrieveIRD() {
- try {
- IRD ird = altoService.getIRD();
- return Response.ok(ird, MediaType.ALTO_DIRECTORY).build();
- } catch (Exception e) {
- }
- return Response.ok("", MediaType.ALTO_ERROR).build();
- }
-
- @Path("/networkmap/{networkmap_id}")
- @GET
- @Produces({ MediaType.ALTO_NETWORKMAP, MediaType.ALTO_ERROR })
- public Response retrieveNetworkMap(
- @PathParam(value = "networkmap_id") String nmap_id) {
- NetworkMap networkMap = altoService.getNetworkMap(new ResourceId(nmap_id));
- try {
- return Response.ok("", MediaType.ALTO_NETWORKMAP).build();
- } catch (Exception e) {
- return Response.ok("", MediaType.ALTO_ERROR).build();
- }
- }
+
+ private static final Logger logger = LoggerFactory.getLogger(AltoNorthbound.class);
+
+ private AltoService altoService = new FakeAltoService();
+ private JSONMapper mapper = new JSONMapper();
+
+ private void checkAltoService() throws Exception {
+ if (altoService == null)
+ throw new AltoBasicException(Status.SERVICE_UNAVAILABLE, null);
+ }
+
+ private void checkResourceId(String rid) throws AltoBadFormatException {
+ if (!FormatValidator.validResourceId(rid))
+ throw new AltoBadFormatException("resource-id", rid);
+ }
+
+ private void checkTag(String tag) throws AltoBadFormatException {
+ if (!FormatValidator.validTag(tag))
+ throw new AltoBadFormatException("tag", tag);
+ }
+
+ private Response fail(Response.Status status, Object data) {
+ try {
+ String output = (data == null ? "" : mapper.asJSON(data));
+ return Response.status(status)
+ .entity(output)
+ .type(MediaType.ALTO_ERROR).build();
+ } catch (Exception e) {
+ logger.error("Failed to parse object to json: {}", data.toString());
+ return Response.status(status)
+ .type(MediaType.ALTO_ERROR).build();
+ }
+ }
+
+ private Response success(Object data, String mediaType) {
+ try {
+ String output = mapper.asJSON(data);
+ return Response.ok(output, mediaType).build();
+ } catch (Exception e) {
+ logger.error("Failed to parse object to json: {}", data.toString());
+ return fail(Status.INTERNAL_SERVER_ERROR, null);
+ }
+ }
+
+ @GET
+ @Produces({ MediaType.ALTO_DIRECTORY, MediaType.ALTO_ERROR })
+ public Response retrieveIRD() throws Exception {
+ checkAltoService();
+
+ IRD ird = altoService.getDefaultIRD();
+ if (ird == null)
+ return fail(Status.NOT_FOUND, null);
+ return success(ird, MediaType.ALTO_DIRECTORY);
+ }
+
+ @Path("/ird/{id}")
+ @GET
+ @Produces({ MediaType.ALTO_DIRECTORY, MediaType.ALTO_ERROR })
+ public Response retrieveIRD(
+ @PathParam("id") String id) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+
+ IRD ird = altoService.getIRD(id);
+ if (ird == null)
+ return fail(Status.NOT_FOUND, id);
+ return success(ird, MediaType.ALTO_DIRECTORY);
+ }
+
+ @Path("/networkmap")
+ @GET
+ @Produces({ MediaType.ALTO_NETWORKMAP, MediaType.ALTO_ERROR })
+ public Response retrieveDefaultNetworkMap() throws Exception {
+ checkAltoService();
+
+ NetworkMap map = altoService.getDefaultNetworkMap();
+ if (map == null)
+ return fail(Status.NOT_FOUND, null);
+ return success(map, MediaType.ALTO_NETWORKMAP);
+ }
+
+ @Path("/networkmap/{id}")
+ @GET
+ @Produces({ MediaType.ALTO_NETWORKMAP, MediaType.ALTO_ERROR })
+ public Response retrieveNetworkMap(
+ @PathParam("id") String id) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+
+ NetworkMap map = altoService.getNetworkMap(id);
+ if (map == null)
+ return fail(Status.NOT_FOUND, id);
+ return success(map, MediaType.ALTO_NETWORKMAP);
+ }
+
+ @Path("/networkmap/{id}/{tag}")
+ @GET
+ @Produces({ MediaType.ALTO_NETWORKMAP, MediaType.ALTO_ERROR })
+ public Response retrieveNetworkMap(
+ @PathParam("id") String id,
+ @PathParam("tag") String tag) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+ checkTag(tag);
+
+ VersionTag vtag = new VersionTag(id, tag);
+ NetworkMap map = altoService.getNetworkMap(vtag);
+ if (map == null)
+ return fail(Status.NOT_FOUND, vtag);
+ return success(map, MediaType.ALTO_NETWORKMAP);
+ }
+
+ @Path("/costmap/{id}")
+ @GET
+ @Produces({ MediaType.ALTO_COSTMAP, MediaType.ALTO_ERROR})
+ public Response retrieveCostMap(@PathParam("id") String id) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+
+ CostMap map = altoService.getCostMap(id);
+ if (map == null)
+ return fail(Status.NOT_FOUND, id);
+ return success(map, MediaType.ALTO_COSTMAP);
+ }
+
+ @Path("/costmap/{id}/{tag}")
+ @GET
+ @Produces({ MediaType.ALTO_COSTMAP, MediaType.ALTO_ERROR})
+ public Response retrieveCostMap(
+ @PathParam("id") String id,
+ @PathParam("tag") String tag) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+ checkTag(tag);
+
+ VersionTag vtag = new VersionTag(id, tag);
+ CostMap map = altoService.getCostMap(vtag);
+ if (map == null)
+ return fail(Status.NOT_FOUND, vtag);
+ return success(map, MediaType.ALTO_COSTMAP);
+ }
+
+ @Path("/costmap/{id}/{mode}/{metric}")
+ @GET
+ @Produces({ MediaType.ALTO_COSTMAP, MediaType.ALTO_ERROR})
+ public Response retrieveCostMap(
+ @PathParam("id") String id,
+ @PathParam("mode") String mode,
+ @PathParam("metric") String metric) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+
+ CostType costType = new CostType(mode, metric);
+ if (!altoService.supportCostType(id, costType))
+ return fail(Status.NOT_FOUND, costType);
+ CostMap map = altoService.getCostMap(id, costType);
+ if (map == null)
+ return fail(Status.NOT_FOUND, id);
+ return success(map, MediaType.ALTO_COSTMAP);
+ }
+
+ @Path("/costmap/{id}/{tag}/{mode}/{metric}")
+ @GET
+ @Produces({ MediaType.ALTO_COSTMAP, MediaType.ALTO_ERROR})
+ public Response retrieveCostMap(
+ @PathParam("id") String id,
+ @PathParam("tag") String tag,
+ @PathParam("mode") String mode,
+ @PathParam("metric") String metric) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+ checkTag(tag);
+
+ VersionTag vtag = new VersionTag(id, tag);
+ CostType costType = new CostType(mode, metric);
+ if (!altoService.supportCostType(vtag, costType))
+ return fail(Status.NOT_FOUND, costType);
+ CostMap map = altoService.getCostMap(vtag, costType);
+ if (map == null)
+ return fail(Status.NOT_FOUND, vtag);
+ return success(map, MediaType.ALTO_COSTMAP);
+ }
+
+ @Path("/filtered/networkmap/{id}")
+ @POST
+ @Consumes({ MediaType.ALTO_NETWORKMAP_FILTER})
+ @Produces({ MediaType.ALTO_NETWORKMAP, MediaType.ALTO_ERROR})
+ public Response retrieveFilteredNetworkMap(
+ @PathParam("id") String id, String filterJSON) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+
+ NetworkMap.Filter filter = mapper.asNetworkMapFilter(filterJSON);
+
+ if (!altoService.validateNetworkMapFilter(id, filter))
+ return fail(Status.BAD_REQUEST, filter);
+ NetworkMap map = altoService.getNetworkMap(id, filter);
+ if (map == null)
+ return fail(Status.NOT_FOUND, id);
+ return success(map, MediaType.ALTO_NETWORKMAP);
+ }
+
+ @Path("/filtered/networkmap/{id}/{tag}")
+ @POST
+ @Consumes({ MediaType.ALTO_NETWORKMAP_FILTER})
+ @Produces({ MediaType.ALTO_NETWORKMAP, MediaType.ALTO_ERROR})
+ public Response retrieveFilteredNetworkMap(
+ @PathParam("id") String id,
+ @PathParam("tag") String tag,
+ String filterJSON) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+ checkTag(tag);
+
+ VersionTag vtag = new VersionTag(id, tag);
+ NetworkMap.Filter filter = mapper.asNetworkMapFilter(filterJSON);
+ if (!altoService.validateNetworkMapFilter(vtag, filter))
+ return fail(Status.BAD_REQUEST, filter);
+
+ NetworkMap map = altoService.getNetworkMap(vtag, filter);
+ if (map == null)
+ return fail(Status.NOT_FOUND, vtag);
+ return success(map, MediaType.ALTO_NETWORKMAP);
+ }
+
+ @Path("/filtered/costmap/{id}")
+ @POST
+ @Consumes({ MediaType.ALTO_COSTMAP_FILTER })
+ @Produces({ MediaType.ALTO_COSTMAP, MediaType.ALTO_ERROR})
+ public Response retrieveFilteredCostMap(
+ @PathParam("id") String id, String filterJSON) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+
+ CostMap.Filter filter = mapper.asCostMapFilter(filterJSON);
+ if (!altoService.validateCostMapFilter(id, filter))
+ return fail(Status.BAD_REQUEST, filter);
+
+ CostMap map = altoService.getCostMap(id, filter);
+ if (map == null)
+ return fail(Status.NOT_FOUND, id);
+ return success(map, MediaType.ALTO_COSTMAP);
+ }
+
+ @Path("/filtered/costmap/{id}/{tag}")
+ @POST
+ @Consumes({ MediaType.ALTO_COSTMAP_FILTER })
+ @Produces({ MediaType.ALTO_COSTMAP, MediaType.ALTO_ERROR})
+ public Response retrieveFilteredCostMap(
+ @PathParam("id") String id,
+ @PathParam("tag") String tag, String filterJSON) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+ checkTag(tag);
+
+ VersionTag vtag = new VersionTag(id, tag);
+ CostMap.Filter filter = mapper.asCostMapFilter(filterJSON);
+ if (!altoService.validateCostMapFilter(vtag, filter))
+ return fail(Status.BAD_REQUEST, filter);
+
+ CostMap map = altoService.getCostMap(vtag, filter);
+ if (map == null)
+ return fail(Status.NOT_FOUND, vtag);
+ return success(map, MediaType.ALTO_COSTMAP);
+ }
+
+ @Path("/endpointprop/lookup/{id}")
+ @POST
+ @Consumes({ MediaType.ALTO_ENDPOINT_PROPPARAMS })
+ @Produces({ MediaType.ALTO_ENDPOINT_PROP, MediaType.ALTO_ERROR })
+ public Response retrieveEndpointPropMap(
+ @PathParam("id") String id,
+ String params) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+
+ Endpoint.PropertyRequest request = mapper.asPropertyRequest(params);
+ Endpoint.PropertyResponse response = altoService.getEndpointProperty(id, request);
+ if (response == null)
+ return fail(Status.NOT_FOUND, request);
+ return success(response, MediaType.ALTO_ENDPOINT_PROP);
+ }
+
+ @Path("/endpointprop/lookup/{id}/{tag}")
+ @POST
+ @Consumes({ MediaType.ALTO_ENDPOINT_PROPPARAMS })
+ @Produces({ MediaType.ALTO_ENDPOINT_PROP, MediaType.ALTO_ERROR })
+ public Response retrieveEndpointPropMap(
+ @PathParam("id") String id,
+ @PathParam("tag") String tag,
+ String params) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+ checkTag(tag);
+
+ VersionTag vtag = new VersionTag(id, tag);
+ Endpoint.PropertyRequest request = mapper.asPropertyRequest(params);
+ Endpoint.PropertyResponse response = altoService.getEndpointProperty(vtag, request);
+ if (response == null)
+ return fail(Status.NOT_FOUND, request);
+ return success(response, MediaType.ALTO_ENDPOINT_PROP);
+ }
+
+ @Path("/endpointcost/lookup/{id}")
+ @POST
+ @Consumes({ MediaType.ALTO_ENDPOINT_COSTPARAMS })
+ @Produces({ MediaType.ALTO_ENDPOINT_COST, MediaType.ALTO_ERROR })
+ public Response retrieveEndpointCostMap(
+ @PathParam("id") String id,
+ String params) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+
+ Endpoint.CostRequest request = mapper.asCostRequest(params);
+ Endpoint.CostResponse response = altoService.getEndpointCost(id, request);
+ if (response == null)
+ return fail(Status.NOT_FOUND, request);
+ return success(response, MediaType.ALTO_ENDPOINT_COST);
+ }
+
+ @Path("/endpointcost/lookup/{id}/{tag}")
+ @POST
+ @Consumes({ MediaType.ALTO_ENDPOINT_COSTPARAMS })
+ @Produces({ MediaType.ALTO_ENDPOINT_COST, MediaType.ALTO_ERROR })
+ public Response retrieveEndpointCostMap(
+ @PathParam("id") String id,
+ @PathParam("tag") String tag,
+ String params) throws Exception {
+ checkAltoService();
+ checkResourceId(id);
+ checkTag(tag);
+
+ VersionTag vtag = new VersionTag(id, tag);
+ Endpoint.CostRequest request = mapper.asCostRequest(params);
+ Endpoint.CostResponse response = altoService.getEndpointCost(vtag, request);
+ if (response == null)
+ return fail(Status.NOT_FOUND, request);
+ return success(response, MediaType.ALTO_ENDPOINT_COST);
+ }
}
--- /dev/null
+package org.opendaylight.alto.northbound.exception;
+
+import javax.ws.rs.core.Response.Status;
+
+public class AltoBadFormatException extends AltoBasicException {
+
+ public static final String TEMPLATE = "Bad %s format: %s";
+
+ public AltoBadFormatException(String field, String value) {
+ super(Status.BAD_REQUEST, String.format(TEMPLATE, field, value));
+ }
+}
--- /dev/null
+package org.opendaylight.alto.northbound.exception;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import org.opendaylight.alto.commons.types.rfc7285.MediaType;
+
+public class AltoBasicException extends WebApplicationException {
+
+ public static final String MEDIA_TYPE = MediaType.ALTO_ERROR;
+
+ public AltoBasicException(int status, Object cause) {
+ super(Response.status(status).entity(cause).type(MEDIA_TYPE).build());
+ }
+
+ public AltoBasicException(Response.Status status, Object cause) {
+ super(Response.status(status).entity(cause).type(MEDIA_TYPE).build());
+ }
+}
--- /dev/null
+package org.opendaylight.alto.northbound.exception;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+import org.opendaylight.alto.commons.types.rfc7285.MediaType;
+
+@Provider
+public class AltoNorthboundExceptionHandler
+ implements ExceptionMapper<Exception> {
+ @Override
+ public Response toResponse(Exception e) {
+ if (e instanceof AltoBasicException)
+ return ((AltoBasicException)e).getResponse();
+ return Response.status(Status.INTERNAL_SERVER_ERROR)
+ .entity(e.getMessage())
+ .type(MediaType.ALTO_ERROR).build();
+ }
+}
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
<parent>
<groupId>org.opendaylight.alto</groupId>
<artifactId>alto-parent</artifactId>
<relativePath>../</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
<artifactId>alto-provider</artifactId>
<packaging>bundle</packaging>
<artifactId>config-api</artifactId>
<version>${config.version}</version>
</dependency>
+
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
<version>${mdsal.version}</version>
</dependency>
+
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-config</artifactId>
<version>${mdsal.version}</version>
</dependency>
+
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-common-util</artifactId>
<version>${mdsal.version}</version>
</dependency>
+
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>${osgi.core.version}</version>
</dependency>
<!-- dependencies to use AbstractDataBrokerTest -->
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-broker-impl</artifactId>
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
+
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
- <version>[4.8.1, 4.11]</version>
<scope>test</scope>
</dependency>
- <!-- used to mock up classes
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-commons</artifactId>
+ <version>${project.version}</version>
</dependency>
- -->
</dependencies>
<tag>HEAD</tag>
<url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
</scm>
-
</project>
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
-public class AltoProvider implements AltoServiceService, DataChangeListener,
- AltoProviderRuntimeMXBean, AutoCloseable {
+public class AltoProvider implements
+ AltoServiceService, DataChangeListener,
+ AltoProviderRuntimeMXBean, AutoCloseable {
- private static final Logger log = LoggerFactory.getLogger(AltoProvider.class);
+ private static final Logger log = LoggerFactory.getLogger(AltoProvider.class);
- public static final InstanceIdentifier<Resources> ALTO_IID = InstanceIdentifier
- .builder(Resources.class).build();
+ public static final InstanceIdentifier<Resources> ALTO_IID
+ = InstanceIdentifier.builder(Resources.class).build();
- private DataBroker dataProvider;
- private final ExecutorService executor;
+ private DataBroker dataProvider;
+ private final ExecutorService executor;
- public AltoProvider() {
- this.executor = Executors.newFixedThreadPool(1);
- }
+ public AltoProvider() {
+ this.executor = Executors.newFixedThreadPool(1);
+ }
- public void setDataProvider(final DataBroker salDataProvider) {
- this.dataProvider = salDataProvider;
- log.info(this.getClass().getName() + " data provider initiated");
- }
-
- @Override
- public void onDataChanged(
- final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
- DataObject dataObject = change.getUpdatedSubtree();
- if (dataObject instanceof Resources) {
- Resources altoResources = (Resources) dataObject;
- log.info("onDataChanged - new ALTO config: {}", altoResources);
+ public void setDataProvider(final DataBroker salDataProvider) {
+ this.dataProvider = salDataProvider;
+ log.info(this.getClass().getName() + " data provider initiated");
+ }
+
+ @Override
+ public void onDataChanged(
+ final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
+ DataObject dataObject = change.getUpdatedSubtree();
+ if (dataObject instanceof Resources) {
+ Resources altoResources = (Resources) dataObject;
+ log.info("onDataChanged - new ALTO config: {}", altoResources);
+ }
}
- }
- @Override
- public Future<RpcResult<EndpointCostServiceOutput>> endpointCostService(
- EndpointCostServiceInput input) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public Future<RpcResult<EndpointCostServiceOutput>> endpointCostService(
+ EndpointCostServiceInput input) {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public Future<RpcResult<FilteredCostMapServiceOutput>> filteredCostMapService(
- FilteredCostMapServiceInput input) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public Future<RpcResult<FilteredCostMapServiceOutput>> filteredCostMapService(
+ FilteredCostMapServiceInput input) {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public Future<RpcResult<FilteredNetworkMapServiceOutput>> filteredNetworkMapService(
- final FilteredNetworkMapServiceInput input) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public Future<RpcResult<FilteredNetworkMapServiceOutput>> filteredNetworkMapService(
+ final FilteredNetworkMapServiceInput input) {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public Long getToastsMade() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void close() throws ExecutionException, InterruptedException {
- executor.shutdown();
- if (dataProvider != null) {
- WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
- tx.delete(LogicalDatastoreType.CONFIGURATION, ALTO_IID);
- Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
- @Override
- public void onSuccess(final Void result) {
- log.debug("Delete ALTO commit result: " + result);
- }
+ @Override
+ public void close() throws ExecutionException, InterruptedException {
+ executor.shutdown();
+ if (dataProvider != null) {
+ WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
+ tx.delete(LogicalDatastoreType.CONFIGURATION, ALTO_IID);
+ Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+ @Override
+ public void onSuccess(final Void result) {
+ log.debug("Delete ALTO commit result: " + result);
+ }
- @Override
- public void onFailure(final Throwable t) {
- log.error("Delete of ALTO failed", t);
+ @Override
+ public void onFailure(final Throwable t) {
+ log.error("Delete of ALTO failed", t);
+ }
+ });
}
- });
}
- }
}
* <br>(Source path: <i>META-INF/yang/alto-provider-impl.yang</i>):
* <pre>
* case alto-provider-impl {
- * leaf toasts-made {
- * type uint32;
- * }
* }
* </pre>
* The schema path to identify an instance is
public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.cachedReference(org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:alto-provider:impl","2014-11-19","alto-provider-impl"));
- java.lang.Long getToastsMade();
}
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state;
-import com.google.common.collect.Range;
import java.util.Collections;
import java.util.Map;
import org.opendaylight.yangtools.yang.binding.DataObject;
import java.util.HashMap;
import org.opendaylight.yangtools.concepts.Builder;
-import com.google.common.collect.ImmutableList;
-import java.math.BigInteger;
-import java.util.List;
import org.opendaylight.yangtools.yang.binding.Augmentation;
*/
public class AltoProviderImplBuilder implements Builder <org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl> {
- private java.lang.Long _toastsMade;
- private static List<Range<BigInteger>> _toastsMade_range;
Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl>> augmentation = new HashMap<>();
}
public AltoProviderImplBuilder(AltoProviderImpl base) {
- this._toastsMade = base.getToastsMade();
if (base instanceof AltoProviderImplImpl) {
AltoProviderImplImpl _impl = (AltoProviderImplImpl) base;
this.augmentation = new HashMap<>(_impl.augmentation);
}
- public java.lang.Long getToastsMade() {
- return _toastsMade;
- }
@SuppressWarnings("unchecked")
public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl>> E getAugmentation(java.lang.Class<E> augmentationType) {
return (E) augmentation.get(augmentationType);
}
- public AltoProviderImplBuilder setToastsMade(java.lang.Long value) {
- if (value != null) {
- BigInteger _constraint = BigInteger.valueOf(value);
- boolean isValidRange = false;
- for (Range<BigInteger> r : _toastsMade_range()) {
- if (r.contains(_constraint)) {
- isValidRange = true;
- }
- }
- if (!isValidRange) {
- throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _toastsMade_range));
- }
- }
- this._toastsMade = value;
- return this;
- }
- public static List<Range<BigInteger>> _toastsMade_range() {
- if (_toastsMade_range == null) {
- synchronized (AltoProviderImplBuilder.class) {
- if (_toastsMade_range == null) {
- ImmutableList.Builder<Range<BigInteger>> builder = ImmutableList.builder();
- builder.add(Range.closed(BigInteger.ZERO, BigInteger.valueOf(4294967295L)));
- _toastsMade_range = builder.build();
- }
- }
- }
- return _toastsMade_range;
- }
public AltoProviderImplBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl> augmentation) {
if (augmentation == null) {
return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl.class;
}
- private final java.lang.Long _toastsMade;
private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl>> augmentation = new HashMap<>();
private AltoProviderImplImpl(AltoProviderImplBuilder base) {
- this._toastsMade = base.getToastsMade();
switch (base.augmentation.size()) {
case 0:
this.augmentation = Collections.emptyMap();
}
}
- @Override
- public java.lang.Long getToastsMade() {
- return _toastsMade;
- }
@SuppressWarnings("unchecked")
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((_toastsMade == null) ? 0 : _toastsMade.hashCode());
result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
return result;
}
return false;
}
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl other = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.state.AltoProviderImpl)obj;
- if (_toastsMade == null) {
- if (other.getToastsMade() != null) {
- return false;
- }
- } else if(!_toastsMade.equals(other.getToastsMade())) {
- return false;
- }
if (getClass() == obj.getClass()) {
// Simple case: we are comparing against self
AltoProviderImplImpl otherImpl = (AltoProviderImplImpl) obj;
java.lang.StringBuilder builder = new java.lang.StringBuilder ("AltoProviderImpl [");
boolean first = true;
- if (_toastsMade != null) {
- if (first) {
- first = false;
- } else {
- builder.append(", ");
- }
- builder.append("_toastsMade=");
- builder.append(_toastsMade);
- }
if (first) {
first = false;
} else {
augment "/config:modules/config:module/config:state" {
case alto-provider-impl {
when "/config:modules/config:module/config:type = 'alto-provider-impl'";
-
- leaf toasts-made {
- type uint32;
- }
-
- rpcx:rpc-context-instance "clear-toasts-made-rpc";
}
}
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>alto-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>services.api</artifactId>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>rfc7285</module>
+ </modules>
+</project>
+
<parent>
<groupId>org.opendaylight.alto</groupId>
- <artifactId>alto-parent</artifactId>
+ <artifactId>services.api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<groupId>org.opendaylight.alto</groupId>
- <artifactId>alto-services</artifactId>
+ <artifactId>service-api-rfc7285</artifactId>
<packaging>bundle</packaging>
<build>
</dependency>
</dependencies>
</plugin>
-
+
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
- org.opendaylight.yang.gen.v1.urn.opendaylight.alto.*,
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924,
- org.opendaylight.yangtools.yang.common,
- org.opendaylight.yangtools.yang.binding,
- org.opendaylight.controller.md.sal.binding.api,
- org.opendaylight.controller.sal.binding.api,
- org.osgi.framework
+ org.opendaylight.alto.commons.types.rfc7285,
</Import-Package>
<Export-Package>
- org.opendaylight.alto.services;
+ org.opendaylight.alto.services.api.rfc7285;
</Export-Package>
- <Bundle-Activator>org.opendaylight.alto.services.AltoService</Bundle-Activator>
+ <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
</instructions>
</configuration>
</plugin>
</plugins>
+
</build>
<dependencies>
<artifactId>alto-model</artifactId>
<version>${project.version}</version>
</dependency>
+
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- <version>${mdsal.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${osgi.core.version}</version>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-commons</artifactId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
</project>
--- /dev/null
+package org.opendaylight.alto.services.api.rfc7285;
+
+//TODO EndpointPropertyService and EndpointCostService not defined yet
+public interface AltoService
+ extends IRDService, NetworkMapService, CostMapService,
+ EndpointPropertyService, EndpointCostService {
+
+}
--- /dev/null
+package org.opendaylight.alto.services.api.rfc7285;
+
+import org.opendaylight.alto.commons.types.rfc7285.CostMap;
+import org.opendaylight.alto.commons.types.rfc7285.VersionTag;
+import org.opendaylight.alto.commons.types.rfc7285.CostType;
+
+public interface CostMapService {
+
+ public CostMap getCostMap(String id);
+
+ public CostMap getCostMap(VersionTag vtag);
+
+ public CostMap getCostMap(String id, CostType type);
+
+ public CostMap getCostMap(VersionTag vtag, CostType type);
+
+ public CostMap getCostMap(String id, CostMap.Filter filter);
+
+ public CostMap getCostMap(VersionTag vtag, CostMap.Filter filter);
+
+ public Boolean supportCostType(String id, CostType type);
+
+ public Boolean supportCostType(VersionTag vtag, CostType type);
+
+ public Boolean validateCostMapFilter(String id, CostMap.Filter filter);
+
+ public Boolean validateCostMapFilter(VersionTag vtag, CostMap.Filter filter);
+
+}
--- /dev/null
+package org.opendaylight.alto.services.api.rfc7285;
+
+import org.opendaylight.alto.commons.types.rfc7285.Endpoint;
+import org.opendaylight.alto.commons.types.rfc7285.VersionTag;
+
+public interface EndpointCostService {
+
+ public Endpoint.CostResponse getEndpointCost(String id, Endpoint.CostRequest request);
+
+ public Endpoint.CostResponse getEndpointCost(VersionTag vtag, Endpoint.CostRequest request);
+
+}
--- /dev/null
+package org.opendaylight.alto.services.api.rfc7285;
+
+import org.opendaylight.alto.commons.types.rfc7285.Endpoint;
+import org.opendaylight.alto.commons.types.rfc7285.VersionTag;
+
+public interface EndpointPropertyService {
+
+ public Endpoint.PropertyResponse getEndpointProperty(String id, Endpoint.PropertyRequest request);
+
+ public Endpoint.PropertyResponse getEndpointProperty(VersionTag vtag, Endpoint.PropertyRequest request);
+
+}
--- /dev/null
+package org.opendaylight.alto.services.api.rfc7285;
+
+import org.opendaylight.alto.commons.types.rfc7285.IRD;
+
+public interface IRDService {
+
+ public IRD getDefaultIRD();
+
+ public IRD getIRD(String id);
+
+}
--- /dev/null
+package org.opendaylight.alto.services.api.rfc7285;
+
+import org.opendaylight.alto.commons.types.rfc7285.NetworkMap;
+import org.opendaylight.alto.commons.types.rfc7285.VersionTag;
+
+public interface NetworkMapService {
+
+ public NetworkMap getDefaultNetworkMap();
+
+ public NetworkMap getNetworkMap(String id);
+
+ public NetworkMap getNetworkMap(VersionTag vtag);
+
+ public NetworkMap getNetworkMap(String id, NetworkMap.Filter filter);
+
+ public NetworkMap getNetworkMap(VersionTag vtag, NetworkMap.Filter filter);
+
+ public Boolean validateNetworkMapFilter(String id, NetworkMap.Filter filter);
+
+ public Boolean validateNetworkMapFilter(VersionTag vtag, NetworkMap.Filter filter);
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>services.ext</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>services.ext.fake</artifactId>
+ <packaging>bundle</packaging>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+
+ <configuration>
+ <failsOnError>true</failsOnError>
+ <configLocation>controller/checkstyle.xml</configLocation>
+ <consoleOutput>true</consoleOutput>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <sourceDirectory>${project.basedir}</sourceDirectory>
+ <excludes>**\/target\/,**\/bin\/,**\/third-party,**\/yang-gen-sal</excludes>
+ </configuration>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>${controller.checkstyle.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>
+ org.opendaylight.alto.services.api.rfc7285,
+ org.opendaylight.alto.commons.types.rfc7285,
+ org.slf4j,
+ </Import-Package>
+ <Export-Package>
+ org.opendaylight.alto.services.ext.fake;
+ </Export-Package>
+ <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>service-api-rfc7285</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+</project>
+
--- /dev/null
+package org.opendaylight.alto.services.ext.fake;
+
+import org.opendaylight.alto.services.api.rfc7285.AltoService;
+import org.opendaylight.alto.commons.types.rfc7285.NetworkMap;
+import org.opendaylight.alto.commons.types.rfc7285.CostMap;
+import org.opendaylight.alto.commons.types.rfc7285.CostType;
+import org.opendaylight.alto.commons.types.rfc7285.VersionTag;
+import org.opendaylight.alto.commons.types.rfc7285.IRD;
+import org.opendaylight.alto.commons.types.rfc7285.JSONMapper;
+import org.opendaylight.alto.commons.types.rfc7285.Endpoint;
+
+public class FakeAltoService implements AltoService {
+
+ private JSONMapper mapper = new JSONMapper();
+
+ private static final String NETWORKMAP_JSON =
+ "{"
+ + "\"meta\" : {"
+ + "\"vtag\": {"
+ + "\"resource-id\": \"default-networkmap\","
+ + "\"tag\": \"3ee2cb7e8d63d9fab71b9b34cbf764436315542e\""
+ + "}"
+ + "},"
+ + "\"network-map\" : {"
+ + "\"PID1\" : {"
+ + "\"ipv4\" : ["
+ + "\"192.0.2.0/24\","
+ + "\"198.51.100.0/25\""
+ + "]"
+ + "},"
+ + "\"PID2\" : {"
+ + "\"ipv4\" : ["
+ + "\"198.51.100.128/25\""
+ + "]"
+ + "},"
+ + "\"PID3\" : {"
+ + "\"ipv4\" : ["
+ + "\"0.0.0.0/0\""
+ + "],"
+ + "\"ipv6\" : ["
+ + "\"::/0\""
+ + "]"
+ + "}"
+ + "}"
+ + "}";
+
+ private static final String DEFAULT_NETWORKMAP_ID = "default-networkmap";
+ private static final String DEFAULT_NETWORKMAP_TAG = "3ee2cb7e8d63d9fab71b9b34cbf764436315542e";
+ private NetworkMap networkMap = null;
+
+ private static final String COSTMAP_JSON =
+ "{"
+ + "\"meta\" : {"
+ + "\"dependent-vtags\" : ["
+ + "{"
+ + "\"resource-id\": \"default-networkmap\","
+ + "\"tag\": \"3ee2cb7e8d63d9fab71b9b34cbf764436315542e\""
+ + "}"
+ + "],"
+ + "\"cost-type\" : {"
+ + "\"cost-mode\" : \"numerical\","
+ + "\"cost-metric\": \"routingcost\""
+ + "}"
+ + "},"
+ + "\"cost-map\" : {"
+ + "\"PID1\": { \"PID1\": 1, \"PID2\": 5, \"PID3\": 10 },"
+ + "\"PID2\": { \"PID1\": 5, \"PID2\": 1, \"PID3\": 15 },"
+ + "\"PID3\": { \"PID1\": 20, \"PID2\": 15 }"
+ + "}"
+ + "}";
+
+ private static final String DEFAULT_COSTMAP_ID = "default-costmap";
+
+ private CostMap costMap = null;
+
+ public FakeAltoService() {
+ try {
+ networkMap = mapper.asNetworkMap(NETWORKMAP_JSON);
+ costMap = mapper.asCostMap(COSTMAP_JSON);
+ } catch (Exception e) {
+ networkMap = null;
+ costMap = null;
+ }
+ }
+
+ public CostMap getCostMap(String id) {
+ if (!DEFAULT_COSTMAP_ID.equals(id))
+ return null;
+ return costMap;
+ }
+
+ public CostMap getCostMap(VersionTag vtag) {
+ return getCostMap(vtag.rid);
+ }
+
+ public CostMap getCostMap(String id, CostType type) {
+ if (!DEFAULT_COSTMAP_ID.equals(id))
+ return null;
+ if (!(costMap.meta.costType.equals(type)))
+ return null;
+ return costMap;
+ }
+
+ public CostMap getCostMap(VersionTag vtag, CostType type) {
+ return getCostMap(vtag.rid, type);
+ }
+
+ public CostMap getCostMap(String id, CostMap.Filter filter) {
+ return null;
+ }
+
+ public CostMap getCostMap(VersionTag vtag, CostMap.Filter filter) {
+ return null;
+ }
+
+ public Boolean supportCostType(String id, CostType type) {
+ return null;
+ }
+
+ public Boolean supportCostType(VersionTag vtag, CostType type) {
+ if (!DEFAULT_COSTMAP_ID.equals(vtag.rid))
+ return new Boolean(false);
+ if (!costMap.meta.costType.equals(type))
+ return new Boolean(false);
+ return new Boolean(true);
+ }
+
+ public Boolean validateCostMapFilter(String id, CostMap.Filter filter) {
+ return false;
+ }
+
+ public Boolean validateCostMapFilter(VersionTag vtag, CostMap.Filter filter) {
+ return false;
+ }
+
+
+ public NetworkMap getDefaultNetworkMap() {
+ return networkMap;
+ }
+
+ public NetworkMap getNetworkMap(String id) {
+ if (!DEFAULT_NETWORKMAP_ID.equals(id))
+ return null;
+ return networkMap;
+ }
+
+ public NetworkMap getNetworkMap(VersionTag vtag) {
+ if (!DEFAULT_NETWORKMAP_ID.equals(vtag.rid))
+ return null;
+ if (!DEFAULT_NETWORKMAP_TAG.equals(vtag.tag))
+ return null;
+ return networkMap;
+ }
+
+ public NetworkMap getNetworkMap(String id, NetworkMap.Filter filter) {
+ return null;
+ }
+
+ public NetworkMap getNetworkMap(VersionTag vtag, NetworkMap.Filter filter) {
+ return null;
+ }
+
+ public Boolean validateNetworkMapFilter(String id, NetworkMap.Filter filter) {
+ return new Boolean(false);
+ }
+
+ public Boolean validateNetworkMapFilter(VersionTag vtag, NetworkMap.Filter filter) {
+ return new Boolean(false);
+ }
+
+ public IRD getDefaultIRD() {
+ return null;
+ }
+
+ public IRD getIRD(String id) {
+ return null;
+ }
+
+ public Endpoint.CostResponse getEndpointCost(String id, Endpoint.CostRequest request) {
+ return null;
+ }
+
+ public Endpoint.CostResponse getEndpointCost(VersionTag vtag, Endpoint.CostRequest request) {
+ return null;
+ }
+
+ public Endpoint.PropertyResponse getEndpointProperty(String id, Endpoint.PropertyRequest request) {
+ return null;
+ }
+
+ public Endpoint.PropertyResponse getEndpointProperty(VersionTag vtag, Endpoint.PropertyRequest request) {
+ return null;
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>services.ext</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>services.ext.fs-map</artifactId>
+ <packaging>bundle</packaging>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+
+ <configuration>
+ <failsOnError>true</failsOnError>
+ <configLocation>controller/checkstyle.xml</configLocation>
+ <consoleOutput>true</consoleOutput>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <sourceDirectory>${project.basedir}</sourceDirectory>
+ <excludes>**\/target\/,**\/bin\/,**\/third-party,**\/yang-gen-sal</excludes>
+ </configuration>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>${controller.checkstyle.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>
+ org.opendaylight.alto.commons.types.rfc7285,
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924,
+ org.slf4j,
+ </Import-Package>
+ <Export-Package>
+ org.opendaylight.alto.services.ext.fsmap;
+ </Export-Package>
+ <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+</project>
+
--- /dev/null
+package org.opendaylight.alto.services.ext.fsmap;
+
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.FileVisitResult;
+import java.nio.file.PathMatcher;
+import java.nio.file.WatchService;
+import java.nio.file.WatchKey;
+import java.nio.file.WatchEvent;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardWatchEventKinds;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.ClosedWatchServiceException;
+import java.nio.file.attribute.BasicFileAttributes;
+
+import java.io.IOException;
+
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.HashMap;
+
+import org.opendaylight.alto.commons.types.rfc7285.JSONMapper;
+import org.opendaylight.alto.commons.types.rfc7285.NetworkMap;
+import org.opendaylight.alto.commons.types.rfc7285.VersionTag;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FileSystemNetworkMapGenerator implements Runnable, AutoCloseable {
+
+ private static final Logger logger = LoggerFactory.getLogger(FileSystemNetworkMapGenerator.class);
+
+ private ReentrantLock lock = new ReentrantLock();
+ private Path source = null;
+ private WatchService watcher = null;
+ private HashMap<Path, WatchKey> keys = new HashMap<Path, WatchKey>();
+ private HashMap<WatchKey, Path> paths = new HashMap<WatchKey, Path>();
+ private MapFileLoader loader = null;
+ private AtomicBoolean cancelled = new AtomicBoolean(false);
+ private HashMap<Path, VersionTag> path_to_id = new HashMap<Path, VersionTag>();
+ private HashMap<VersionTag, NetworkMap> id_to_map = new HashMap<VersionTag, NetworkMap>();
+ private JSONMapper mapper = new JSONMapper();
+
+ public FileSystemNetworkMapGenerator(URI uri) throws Exception {
+ source = Paths.get(uri);
+
+ FileSystem fs = source.getFileSystem();
+ watcher = fs.newWatchService();
+ if (watcher == null) {
+ throw new IOException("Unable to create watcher on given uri: " + uri);
+ }
+
+ onCreateDir(source);
+
+ loader = new MapFileLoader(fs);
+ Files.walkFileTree(source, loader);
+ }
+
+ class MapFileLoader extends SimpleFileVisitor<Path> {
+ private PathMatcher matcher = null;
+
+ MapFileLoader(FileSystem fs) {
+ matcher = fs.getPathMatcher("glob:**/*.{networkmap}");
+ }
+
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+ lock.lock();
+ onCreateDir(dir);
+ lock.unlock();
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+ logger.info("visiting file: " + file.toString());
+ if (file.toFile().isFile()) {
+ if (matcher.matches(file)) {
+ lock.lock();
+ onCreate(file);
+ lock.unlock();
+ }
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ }
+
+ public void run() {
+ while (!cancelled.get()) {
+ WatchKey key;
+ try {
+ key = watcher.take();
+ } catch (ClosedWatchServiceException e) {
+ System.out.println(e);
+ break;
+ } catch (Exception e) {
+ System.out.println(e);
+ continue;
+ }
+
+ for (WatchEvent<?> event: key.pollEvents()) {
+ WatchEvent.Kind<?> kind = event.kind();
+
+ if (kind == StandardWatchEventKinds.OVERFLOW)
+ continue;
+
+ lock.lock();
+ Path dir = paths.get(key);
+ Path file = dir.resolve((Path)event.context());
+
+ if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
+ if (file.toFile().isFile())
+ onCreate(file);
+ else if (file.toFile().isDirectory())
+ onCreateDir(file);
+ } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) {
+ if (file.toFile().isFile())
+ onDelete(file);
+ else if (file.toFile().isDirectory())
+ onDeleteDir(file);
+ } else if (kind == StandardWatchEventKinds.ENTRY_MODIFY) {
+ if (file.toFile().isFile())
+ onModify(file);
+ else if (file.toFile().isDirectory())
+ onModifyDir(file);
+ }
+ lock.unlock();
+ }
+
+ boolean valid = key.reset();
+ if (!valid) {
+ Path dir = paths.get(key);
+ keys.remove(dir);
+ paths.remove(key);
+
+ if (keys.isEmpty())
+ break;
+ }
+ }
+ cleanup();
+ }
+
+ public void cleanup() {
+ lock.lock();
+ for (WatchKey key: keys.values()) {
+ try {
+ if (key != null) {
+ key.cancel();
+ }
+ } catch (Exception e) {
+ }
+ }
+ keys.clear();
+ paths.clear();
+ try {
+ if (watcher != null) {
+ watcher.close();
+ watcher = null;
+ }
+ } catch (Exception e) {
+ }
+
+ for (VersionTag vtag: path_to_id.values()) {
+ // TODO remove network map
+ if (vtag.incomplete())
+ continue;
+ }
+ path_to_id.clear();
+ id_to_map.clear();
+ lock.unlock();
+ }
+
+ public void close() {
+ cancelled.set(true);
+ cleanup();
+ }
+
+ public void onCreate(Path file) {
+ //TODO
+ try {
+ String content = new String(Files.readAllBytes(file), StandardCharsets.US_ASCII);
+ NetworkMap map = mapper.asNetworkMap(content);
+
+ VersionTag vtag = map.meta.vtag;
+ logger.info("vtag: <" + vtag.rid + ", " + vtag.tag + ">");
+ if (id_to_map.get(map.meta.vtag) != null) {
+ logger.warn("Version tag already registered: ("
+ + vtag.rid + ", " + vtag.tag + ")");
+ return;
+ }
+ path_to_id.put(file, map.meta.vtag);
+ id_to_map.put(map.meta.vtag, map);
+ logger.info("create successfully: " + file.toString());
+ logger.info("current maps: " + id_to_map.size());
+ } catch (Exception e) {
+ logger.warn("Error while creating " + file.toString());
+ logger.warn(e.toString());
+ }
+ }
+
+ public void onCreateDir(Path dir) {
+ try {
+ WatchKey key = dir.register(watcher,
+ StandardWatchEventKinds.ENTRY_CREATE,
+ StandardWatchEventKinds.ENTRY_DELETE,
+ StandardWatchEventKinds.ENTRY_MODIFY);
+ keys.put(dir, key);
+ paths.put(key, dir);
+ logger.info("create dir successfully: " + dir.toString());
+ } catch (Exception e) {
+ logger.warn(e.toString());
+ }
+ }
+
+ public void onDelete(Path file) {
+ //TODO
+ try {
+ VersionTag vtag = path_to_id.get(file);
+ if (vtag == null)
+ return;
+
+ id_to_map.remove(vtag);
+ logger.info("delete: " + file.toString());
+ } catch (Exception e) {
+ logger.warn("Error while deleting " + file.toString());
+ logger.warn(e.toString());
+ }
+ }
+
+ public void onDeleteDir(Path dir) {
+ // TODO
+ try {
+ WatchKey key = keys.get(dir);
+ if (key != null) {
+ key.cancel();
+
+ keys.remove(dir);
+ paths.remove(key);
+ }
+ logger.warn("delete dir successfully: " + dir.toString());
+ } catch (Exception e) {
+ logger.warn(e.toString());
+ }
+ }
+
+ public void onModify(Path file) {
+ //TODO
+ try {
+ String content = new String(Files.readAllBytes(file), StandardCharsets.US_ASCII);
+ NetworkMap map = mapper.asNetworkMap(content);
+ VersionTag vtag = map.meta.vtag;
+ VersionTag old = path_to_id.get(file);
+
+ if (old != null) {
+ if (vtag.rid != old.rid) {
+ throw new Exception("defining another map in one file is not allowed");
+ }
+ id_to_map.remove(old);
+ }
+ path_to_id.put(file, vtag);
+ id_to_map.put(vtag, map);
+ logger.info("modify successfully: " + file.toString());
+ } catch (Exception e) {
+ logger.warn("Error while modifying " + file.toString());
+ logger.warn(e.toString());
+ }
+ }
+
+ public void onModifyDir(Path dir) {
+ //TODO
+ onDeleteDir(dir);
+ onModifyDir(dir);
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>alto-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>services.ext</artifactId>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>fs-map</module>
+ <module>fake</module>
+ </modules>
+
+</project>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>alto-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>services.provider</artifactId>
+ <packaging>pom</packaging>
+
+ <modules>
+ </modules>
+
+</project>
+
+++ /dev/null
-package org.opendaylight.alto.services;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.AbstractBrokerAwareActivator;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.IRDBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.NetworkMaps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMapKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.CostMetric;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.CostMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.CostTypeName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.IRD;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.MediaType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ResourceId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.cost.types.CostTypes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.cost.types.CostTypesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.cost.types.CostTypesKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ird.MetaBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ird.data.Resources;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ird.data.ResourcesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ird.data.ResourcesKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.osgi.framework.BundleContext;
-
-import com.google.common.base.Optional;
-
-public class AltoService extends AbstractBrokerAwareActivator implements BindingAwareConsumer {
- private DataBroker dataBroker;
-
- @Override
- public void onSessionInitialized(ConsumerContext session) {
- this.dataBroker = session.getSALService(DataBroker.class);
- }
-
- public NetworkMap getNetworkMap(ResourceId resourceId) {
- ReadTransaction tx = dataBroker.newReadOnlyTransaction();
- Optional<NetworkMap> networkMap = null;
- try {
- InstanceIdentifier<NetworkMap> npIID = InstanceIdentifier
- .builder(org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.Resources.class)
- .child(NetworkMaps.class)
- .child(NetworkMap.class, new NetworkMapKey(new ResourceId(resourceId)))
- .build();
- networkMap = tx.read(LogicalDatastoreType.OPERATIONAL, npIID).get();
- } catch (InterruptedException | ExecutionException e) {
- e.printStackTrace();
- }
-
- return networkMap.get();
- }
-
- public IRD getIRD() {
- IRDBuilder irdb = new IRDBuilder();
- MetaBuilder mb = new MetaBuilder();
-
- List<CostTypes> cost_types = new ArrayList<CostTypes>();
- CostTypesBuilder cb = new CostTypesBuilder();
- CostTypeName name = new CostTypeName("num-routing");
- CostMetric metric = new CostMetric(CostMetric.Enumeration.Routingcost);
- CostMode mode = CostMode.Numerical;
- CostTypesKey ckey = new CostTypesKey(name);
-
- cost_types.add(cb.setCostTypeName(name).setCostMetric(metric).setCostMode(mode).setKey(ckey).build());
- irdb.setMeta(mb.setCostTypes(cost_types).build());
-
- List<Resources> resources = new ArrayList<Resources>();
- ResourcesBuilder rb = new ResourcesBuilder();
-
- MediaType mt = new MediaType(MediaType.Enumeration.AltoNetworkmap);
- Uri uri = new Uri("http://localhost:8080/controller/nb/v2/networkmap/default");
- ResourcesKey rkey = new ResourcesKey(new ResourceId("my-default-networkmap"));
-
- resources.add(rb.setMediaType(mt).setUri(uri).setKey(rkey).build());
- irdb.setResources(resources);
-
- return irdb.build();
- }
-
- @Override
- protected void onBrokerAvailable(BindingAwareBroker broker, BundleContext context) {
- broker.registerConsumer(this);
- }
-}
<relativePath>../</relativePath>
</parent>
- <groupId>org.opendaylight.alto</groupId>
<artifactId>alto-features</artifactId>
<name>${project.artifactId}</name>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-mdsal</artifactId>
<classifier>features</classifier>
- <version>${mdsal.version}</version>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-restconf</artifactId>
<classifier>features</classifier>
- <version>${mdsal.version}</version>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>alto-services</artifactId>
+ <artifactId>alto-provider</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>alto-provider</artifactId>
+ <artifactId>alto-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-config</artifactId>
<version>${project.version}</version>
</dependency>
<bundle>mvn:org.opendaylight.alto/alto-model/${project.version}</bundle>
</feature>
+ <feature name='odl-alto-jackson-dependency' version='${project.version}' description='Opendaylight :: alto :: jackson_dependency'>
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+ </feature>
+
+ <feature name='odl-alto-commons' version='${project.version}' description='OpenDaylight :: alto :: utils'>
+ <feature version='${project.version}'>odl-alto-model</feature>
+ <feature version='${jackson.version}'>odl-base-jackson</feature>
+ <bundle>mvn:org.opendaylight.alto/commons/${project.version}</bundle>
+ </feature>
+
<feature name='odl-alto-provider' version='${project.version}' description='OpenDaylight :: alto :: Provider'>
<feature version='${project.version}'>odl-alto-model</feature>
<feature version='${mdsal.version}'>odl-mdsal-broker</feature>
<bundle>mvn:org.opendaylight.alto/alto-provider/${project.version}</bundle>
</feature>
+ <feature name='odl-alto-extension' version='${project.version}' description='Opendaylight :: alto :: extension'>
+ <feature version='${project.version}'>odl-alto-utils</feature>
+ <bundle>mvn:org.opendaylight.alto/services.ext.fs-map/${project.version}</bundle>
+ </feature>
+
<feature name='odl-alto-manager' version='${project.version}' description='OpenDaylight :: alto :: Provider'>
<feature version='${jackson.version}'>odl-base-jackson</feature>
<configfile finalname="configuration/default.networkmap">mvn:org.opendaylight.alto/alto-manager/${project.version}/xml/config</configfile>
<feature version='${mdsal.version}'>odl-mdsal-common</feature>
<feature version='${mdsal.version}'>odl-mdsal-broker</feature>
<feature version='${jackson.version}'>odl-base-jackson</feature>
- <bundle>mvn:org.opendaylight.alto/alto-commons/${project.version}</bundle>
+ <feature version='${project.version}'>odl-alto-commons</feature>
<bundle>mvn:org.opendaylight.alto/alto-services/${project.version}</bundle>
</feature>
<feature name='odl-alto-northbound' version='${project.version}' description='Opendaylight :: alto :: Northbound'>
- <feature version='${project.version}'>odl-alto-services</feature>
<feature version='${jersey.version}'>odl-base-jersey</feature>
<feature version='${war.version}'>war</feature>
<feature version='${controller.commons.northbound.version}'>odl-adsal-northbound</feature>
+ <feature version='${project.version}'>odl-alto-utils</feature>
+ <bundle>mvn:org.opendaylight.alto/service-api-rfc7285/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.alto/services.ext.fake/${project.version}</bundle>
<bundle>mvn:org.opendaylight.alto/alto-northbound/${project.version}</bundle>
</feature>
- <!-- TODO not implemented yet
- <feature name='odl-alto-provider-rest' version='${project.version}' description='OpenDaylight :: alto :: provider :: REST '>
- <feature version="${project.version}">odl-alto-provider</feature>
- <feature version="${mdsal.version}">odl-restconf</feature>
- </feature>
- <feature name='odl-alto-provider-ui' version='${project.version}' description='OpenDaylight :: alto :: provider :: UI'>
- <feature version="${project.version}">odl-alto-provider-rest</feature>
- <feature version="${mdsal.version}">odl-mdsal-apidocs</feature>
- <feature version="${mdsal.version}">odl-mdsal-xsql</feature>
- </feature>
- -->
</features>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath/>
</parent>
<groupId>org.opendaylight.alto</groupId>
<jersey.servlet.version>1.17</jersey.servlet.version>
<jersey.json.version>1.17</jersey.json.version>
<jackson.version>2.3.2</jackson.version>
- <config.version>0.3.0-SNAPSHOT</config.version>
<yangtools.version>0.7.0-SNAPSHOT</yangtools.version>
<yangtools.binding.version>0.7.0-SNAPSHOT</yangtools.binding.version>
<module>alto-model</module>
<module>alto-config</module>
<module>alto-provider</module>
- <module>alto-artifacts</module>
<module>features</module>
<module>alto-commons</module>
+ <module>alto-services/api</module>
+ <module>alto-services/ext</module>
+ <module>alto-services/provider</module>
<module>alto-manager</module>
- <module>alto-services</module>
- <!--
- <module>alto-karaf</module>
- -->
<module>alto-northbound</module>
</modules>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <configuration>
- <includes>
- <include>org.opendaylight.sfc.*</include>
- </includes>
- </configuration>
- <executions>
- <execution>
- <id>pre-test</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>post-test</id>
- <goals>
- <goal>report</goal>
- </goals>
- <phase>test</phase>
- </execution>
- </executions>
- </plugin>
</plugins>
<pluginManagement>
<plugins>