key "dst";
choice cost {
case type-numerical {
- leaf cost-value {
+ leaf numerical-cost-value {
type decimal64 {
fraction-digits 4;
}
}
}
case type-ordinal {
- leaf cost-value {
+ leaf ordinal-cost-value {
type int32;
}
}
Cost cost = dstCosts.getCost();
if (cost instanceof TypeNumerical) {
costmapDestinationBuilder.setCost(new NumericalBuilder()
- .setCost(((TypeNumerical) cost).getCostValue())
+ .setCost(((TypeNumerical) cost).getNumericalCostValue())
.build());
} else if (cost instanceof TypeOrdinal) {
costmapDestinationBuilder.setCost(new OrdinalBuilder()
- .setCost(((TypeOrdinal) cost).getCostValue())
+ .setCost(((TypeOrdinal) cost).getOrdinalCostValue())
.build());
}
costmapDestinations.add(costmapDestinationBuilder.build());
@GET
@Produces({ALTO_COSTMAP, ALTO_ERROR})
public Response getFullMap(@PathParam("path") String path) throws JsonProcessingException{
- QueryInput input = prepareDefaultInput(path);
+ QueryInput input = prepareDefaultInput(path, "numerical", "hopcount");
+ Future<RpcResult<QueryOutput>> outputFuture = mapService.query(input);
+ QueryOutput output = null;
+ try {
+ output = outputFuture.get().getResult();
+ } catch (Exception e) {
+ LOG.warn("get output failed:" , e);
+ }
+ Response response = buildOutput(input, output);
+ if(response != null)
+ return response;
+ else
+ return Response.status(404).build();
+ }
+
+ @Path("{path}/{mode}")
+ @GET
+ @Produces({ALTO_COSTMAP, ALTO_ERROR})
+ public Response getFullMap(@PathParam("path") String path,
+ @PathParam("mode") String mode) throws JsonProcessingException{
+ QueryInput input = prepareDefaultInput(path, mode, "hopcount");
+ Future<RpcResult<QueryOutput>> outputFuture = mapService.query(input);
+ QueryOutput output = null;
+ try {
+ output = outputFuture.get().getResult();
+ } catch (Exception e) {
+ LOG.warn("get output failed:" , e);
+ }
+ Response response = buildOutput(input, output);
+ if(response != null)
+ return response;
+ else
+ return Response.status(404).build();
+ }
+
+ @Path("{path}/{mode}/{metric}")
+ @GET
+ @Produces({ALTO_COSTMAP, ALTO_ERROR})
+ public Response getFullMap(@PathParam("path") String path,
+ @PathParam("mode") String mode,
+ @PathParam("metric") String metric) throws JsonProcessingException{
+ QueryInput input = prepareDefaultInput(path, mode, metric);
Future<RpcResult<QueryOutput>> outputFuture = mapService.query(input);
QueryOutput output = null;
try {
return new LinkedList<String>(retval);
}
- protected QueryInput prepareDefaultInput(String rid) {
+ protected QueryInput prepareDefaultInput(String rid, String cost_mode, String cost_metric) {
/*
- * Set pids as empty so all PID should be returned.
- *
- * Set address-types as missing so all address types should be returned.
+ * Set source and destination pids as empty so all PID pairs should be returned.
*
- * See https://tools.ietf.org/html/rfc7285#section-11.3.1.3
+ * See https://tools.ietf.org/html/rfc7285#section-11.3.2.3
*
* */
- return prepareInput(rid, null, null, new LinkedList<String>(), new LinkedList<String>());
+ return prepareInput(rid, cost_mode, cost_metric, new LinkedList<String>(), new LinkedList<String>());
}
protected QueryInput prepareInput(String path, String cost_mode, String cost_metric, List<String> pid_source, List<String> pid_destination) {
<classifier>config</classifier>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-northbound-route-costmap-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-northbound-route-costmap-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-northbound-route-costmap-impl</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-northbound-route-endpointcost-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-northbound-route-endpointcost-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-northbound-route-endpointcost-impl</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.alto.core</groupId>
<artifactId>alto-service-model-ird-api</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-service-model-config-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.alto.basic</groupId>
<artifactId>alto-simple-ird-impl</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-manual-maps-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-manual-maps-impl</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.alto.basic</groupId>
+ <artifactId>alto-manual-maps-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.alto.basic</groupId>
<artifactId>alto-simple-ird-impl</artifactId>
<configfile finalname="${configfile.directory}/alto-northbound-route-networkmap.xml">
mvn:org.opendaylight.alto.core/alto-northbound-route-networkmap-impl/${project.version}/xml/config
</configfile>
+
+ <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-costmap-api/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-costmap-impl/${project.version}</bundle>
+ <configfile finalname="${configfile.directory}/alto-northbound-route-costmap.xml">
+ mvn:org.opendaylight.alto.core/alto-northbound-route-costmap-impl/${project.version}/xml/config
+ </configfile>
+
+ <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-endpointcost-api/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-endpointcost-impl/${project.version}</bundle>
+ <configfile finalname="${configfile.directory}/alto-northbound-route-endpointcost.xml">
+ mvn:org.opendaylight.alto.core/alto-northbound-route-endpointcost-impl/${project.version}/xml/config
+ </configfile>
</feature>
<feature name='odl-alto-standard-resource-translator' version='${project.version}'
<feature name='odl-alto-manual-maps' version='${project.version}'
description='OpenDaylight :: alto :: manual-maps'>
- <!-- TODO -->
+ <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
+ <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
+
+ <feature version='${project.version}'>odl-alto-northbound</feature>
+ <feature version='${project.version}'>odl-alto-resourcepool</feature>
+ <feature version='${project.version}'>odl-alto-standard-service-models</feature>
+
+ <bundle>mvn:org.opendaylight.alto.core/alto-service-model-config-api/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.alto.basic/alto-manual-maps-api/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.alto.basic/alto-manual-maps-impl/${project.version}</bundle>
+ <configfile finalname="${configfile.directory}/alto-manual-maps.xml">
+ mvn:org.opendaylight.alto.basic/alto-manual-maps-impl/${project.version}/xml/config
+ </configfile>
</feature>
<feature name='odl-alto-hosttracker' version='${project.version}'
--- /dev/null
+#!/bin/bash
+
+RESOURCE_ID=$1
+TAG=$2
+if [ $3 ]; then
+ CONTEXT_ID=$3
+else
+ CONTEXT_ID="00000000-0000-0000-0000-000000000000"
+fi
+URL="http://localhost:8181/restconf/config/alto-manual-maps:config-context/"$CONTEXT_ID"/resource-cost-map/"$RESOURCE_ID
+
+echo $URL
+
+DATA=$(cat ./manualmaps/template/template_costmap \
+ | sed 's/\$1/'$RESOURCE_ID'/g' \
+ | sed 's/\$2/'$TAG'/g')
+
+echo $DATA
+
+curl -X PUT -u admin:admin -v \
+ -H "Content-Type: application/json" -d "$(echo $DATA)"\
+ $URL
--- /dev/null
+{
+ "resource-cost-map": {
+ "resource-id": "$1",
+ "tag": "$2",
+ "meta": {
+ "dependent-vtags": [
+ {
+ "resource-id": "test-manual-networkmaps",
+ "tag": "455e4fcb78c3b0fb69f993d49b197f0e"
+ }
+ ]
+ },
+ "map": [
+ {
+ "src": "PID0",
+ "dst-costs": [
+ {
+ "dst": "PID1",
+ "numerical-cost-value": 2
+ }
+ ]
+ }
+ ]
+ }
+}