Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Contents

Table of Contents

...

The OOF will provide a library of adapters for common ONAP systems. These can be directly used in data specification templates of the applications. In the initial release, these will include adapters to Policy, A&AI, SDN-C, Multi-Cloud, and SDC (additional "stretch goals" for this release include SDN-C, Microservice Bus). As new use cases are implemented, this library will be augmented by new adapters to other services.   

Translation Modules

The OOF will provide modules for translating policies into constraints for the optimization environment. When an underlying minizinc model is used for optimization, it is translated into a minizinc constraint (either via a data specification template or directly from policy). For custom optimizers, these constraints will be translated to the input format expected by the optimizer via the data specification template. The Homing and Allocation Service (HAS; described in the next section) uses a custom optimization module and hence uses the data specification template approach.

...

Section
bordertrue

Minizinc Model

Panel
titleMiniZinc model for the example application (budget constrained network flow optimization model). This model can be composed from different components, each independently contributed by contrbutors with different expertise and roles, as described above.
int: N;  % input nodes 
int: M;  % output nodes 
int: maxbw; % max bandwidth (for convenience) 
float: budget;

set of int: inNodes = 1..N;
set of int: outNodes = 1..M;

array[inNodes] of int: inCap;  % capacities for input nodes 
array[outNodes] of int: outCap;  % capacity for output nodes 
array[inNodes, outNodes] of int: bw;  % max bandwidth of link 
array[inNodes, outNodes] of float: cost;  % unit cost for the link 
array[inNodes, outNodes] of var 0..maxbw: x;  % amount through this link 

constraint forall (i in inNodes) (sum (j in outNodes) (x[i,j]) <= inCap[i]);
constraint forall (j in outNodes) (sum (i in inNodes) (x[i,j]) <= outCap[j]);
constraint forall (i in inNodes, j in outNodes) (x[i,j] <= bw[i,j]);

constraint sum (i in inNodes, j in outNodes) (x[i,j] * cost[i,j]) <= budget;

Info

% Example of a constraint policy pushed by an Ops person at run-time (by "enabling" and/or configuring a policy)
% The OOF will inject the translated policy into the MiniZinc model for subsequent requests to this service

% another "stringent" service-specific policy 
constraint sum (i in inNodes, j in outNodes) (x[i,j] * cost[i,j]) <= 0.8 * budget;

Info

% Example of a constraint policy specified and/or pushed by a service designer at design time
% The OOF will inject the translated policy into the MiniZinc model for all requests to this service


% each link cannot have more than 20% of traffic from a customer 
var flow = sum (i in inNodes, j in outNodes) (x[i,j]);
constraint forall (i in inNodes, j in outNodes) (x[i,j] <= 0.2 * flow);

solve maximize sum (i in inNodes, j in outNodes) (x[i,j]);

Minizinc Data Template

Panel
titleData file used in the for the example application. The file format is dzn (Minizinc data format) and the file uses the widely used jinja2 templating for Python, with support for OOF to objects such as "input" (the input API request), SDC (a dummy object that provides network capacities of nodes, as well as cost per unit network utilization), and AAI (another dummy object that provides bandwith for links among different nodes). This data template is rendered into a data file (dzn format), which, together with the model file defines a complete optimization problem.
% Relevant calls to APIs
{% inNodes, outNodes, budget = input.get("inNodes", "outNodes", "budget") %}
{% inCap, outCap = SDC.getCapacities(inNodes, outNodes) %};
{% bw = AAI.getBandwidthMatrix(inNodes, outNodes) %};
{% cost = SDC.getNetworkCostMatrix(inNodes, outNodes) %};

N = {{ len(inNodes) }};
M = {{ len(outNodes) }};
maxbw = {{ max(max(bw)) }};
budget = {{ budget }};

inCap = {{ inCap }};
outCap = {{ outCap }};

bw = {{ mzn.toMatrix(bw) }}; % writes it out as minizinc matrix
cost = {{ mzn.toMatrix(cost) }};

Minizinc Data File

Panel
titleRendered Minizinc Data File (from Template)
N = 5;
M = 4;
maxbw = 20;
budget = 50;

inCap = [10, 5, 0, 4, 20];

outCap = [10, 0, 5, 4];

bw = [| 10,  5,  0,  0
      |  2,  4, 10,  0
      |  4,  4, 10,  0
      |  2,  0,  0,  5
      |  0,  0,  0,  1 |];

cost = [|  1,  1, 10, 20
        | 90, 90, 90, 90
        |  2,  1,  1,  1
        |  2, 10, 10,  1
        |  9,  9,  9, 99.9 |];

...