1 % Copyright 2020 ArctosLabs Scandinavia AB
3 % Licensed under the Apache License, Version 2.0 (the "License");
4 % you may not use this file except in compliance with the License.
5 % You may obtain a copy of the License at
7 % http://www.apache.org/licenses/LICENSE-2.0
9 % Unless required by applicable law or agreed to in writing, software
10 % distributed under the License is distributed on an "AS IS" BASIS,
11 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 % See the License for the specific language governing permissions and
14 % limitations under the License.
15 {%- macro vim_accounts(vim_accounts) -%}
17 {%- for vim in vim_accounts %}
18 {{vim}}{% if loop.nextitem is defined%},{% endif %}
23 {%- macro variables_vnf(ns_desc) -%}
24 {%- for vnf in ns_desc -%}
25 {%- if vnf.vim_account %}
26 Vims: VNF{{vnf.vnf_id}} = {{vnf.vim_account}};
28 var Vims: VNF{{vnf.vnf_id}};
33 {%- macro trp_link_latency(trp_link_latency) -%}
34 array[Vims, Vims] of int: trp_link_latency = [
35 {%- for row in trp_link_latency -%}
37 {%- for col in row -%}
41 |]; % Transport link latency between data centers
44 {%- macro trp_link_jitter(trp_link_jitter) -%}
45 array[Vims, Vims] of int: trp_link_jitter = [
46 {%- for row in trp_link_jitter -%}
48 {%- for col in row -%}
52 |]; % Transport link jitter between data centers
55 {%- macro trp_link_price_list(trp_link_price_list) -%}
56 array[Vims, Vims] of int: trp_link_price_list = [
57 {%- for row in trp_link_price_list -%}
59 {%- for col in row -%}
63 |]; % Transport link price list
66 {%- macro vnf_price_list_per_vim(ns_desc) -%}
67 {%- for vnf in ns_desc -%}
68 array[Vims] of int: vim_price_list_{{vnf.vnf_id}} = [
69 {%- for price in vnf.vnf_price_per_vim -%}
70 {{price}}{% if loop.nextitem is defined%},{% endif %}
76 {%- macro vld_constraints(vld_desc) -%}
77 {%- for cp in vld_desc -%}
78 {%- if 'latency' in cp.keys()%}
79 constraint trp_link_latency[VNF{{cp.cp_refs[0]}}, VNF{{cp.cp_refs[1]}}] <= {{cp.latency}};
82 {%- for cp in vld_desc -%}
83 {%- if 'jitter' in cp.keys()%}
84 constraint trp_link_jitter[VNF{{cp.cp_refs[0]}}, VNF{{cp.cp_refs[1]}}] <= {{cp.jitter}};
89 {% macro transport_cost(vld_desc) -%}
90 var int: used_transport_cost =
91 {%- if not vld_desc -%}
94 {%- for cp in vld_desc -%}
95 trp_link_price_list[VNF{{cp.cp_refs[0]}}, VNF{{cp.cp_refs[1]}}]{% if loop.nextitem is defined %}+{% else %};{% endif %}
100 {%- macro used_vim_cost(ns_desc) -%}
101 var int: used_vim_cost =
102 {%- for vnf in ns_desc -%}
103 vim_price_list_{{vnf.vnf_id}}[VNF{{vnf.vnf_id}}]{% if loop.nextitem is defined %}+{% else %};{% endif %}