Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 0f655cb

Browse files
committed
NS Manager/Provisioning supports manual mapping of PoPs for each VNF. UI updated supporting it
1 parent 3b9b98e commit 0f655cb

File tree

13 files changed

+221
-206
lines changed

13 files changed

+221
-206
lines changed

hot-generator/models/wicm_to_hot.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def build(provider_info)
4141
2.times {networks_name << create_network}
4242

4343
# Create the subnets for all networks
44-
networks_name.each_with_index {|name, index| create_subnet(name, 250 + index, ['8.8.8.8'])}
44+
networks_name.each_with_index {|name, index| create_subnet(name, rand(256).to_s + '.' + rand(256).to_s + '.' + rand(256).to_s + '.0/24', ['8.8.8.8'])}
4545

4646
# Create the Service Function Forwarder machine
4747
#create_server('image_name', create_flavor, create_ports(networks_name))
@@ -116,9 +116,9 @@ def create_network
116116
# @param [String] network_name the network name
117117
# @param [String] cidr the CIDR for the network
118118
# @return [String] the name of the created subnet
119-
def create_subnet(network_name, index, dns_server)
119+
def create_subnet(network_name, cidr, dns_server)
120120
name = get_resource_name
121-
@hot.resources_list << Subnet.new(name, {get_resource: network_name}, dns_server, index)
121+
@hot.resources_list << Subnet.new(name, {get_resource: network_name}, [dns_server], cidr)
122122
name
123123
end
124124

ns-manager/helpers/statistics.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module StatisticsHelper
2121

2222
# Update specific statistic
2323
#
24-
# @param [Symbol] format the format type, `:text` or `:html`
24+
# @param [string] name etric Name
2525
# @return [String] the object converted into the expected format.
2626
def updateStatistics(name)
2727
begin
@@ -36,7 +36,7 @@ def updateStatistics(name)
3636

3737
# Get list of PoPs
3838
#
39-
# @param [Symbol] format the format type, `:text` or `:html`
39+
# @param [Hash] instance
4040
# @return [String] the object converted into the expected format.
4141
def savePerformance(instance)
4242

ns-manager/routes/ns_provisioning.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class NsProvisioner < TnovaManager
4848

4949
pop_list = []
5050
mapping_info = {}
51-
if instantiation_info['pop_id'].nil?
51+
if instantiation_info['pop_id'].nil? && instantiation_info['vnf_pop'].nil?
5252
available_pops = getDcs()
5353
if available_pops.empty?
5454
halt 400, "No PoPs registereds."
@@ -67,6 +67,10 @@ class NsProvisioner < TnovaManager
6767
#deploy to the unic PoP
6868
pop_list << getDc(available_pops[0]['id'])
6969
end
70+
elsif !instantiation_info['vnf_pop'].nil?
71+
instantiation_info['vnf_pop'].each_pair do |key, value|
72+
pop_list << getDc(value)
73+
end
7074
else
7175
#deploying the Instance into the requested PoP
7276
pop_list << getDc(instantiation_info['pop_id'])
@@ -83,7 +87,8 @@ class NsProvisioner < TnovaManager
8387
:flavour => instantiation_info['flavour'],
8488
:pop_list => pop_list,
8589
:mapping => mapping_info,
86-
:infr_repo_url => infr_repo_url
90+
:infr_repo_url => infr_repo_url,
91+
:vnf_mapping => instantiation_info['vnf_pop']
8792
}
8893
begin
8994
response = RestClient.post provisioner.host + request.fullpath, provisioning.to_json, 'X-Auth-Token' => provisioner.token, :content_type => :json

ns-manager/routes/scaling.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# limitations under the License.
1717
#
1818
# @see NsScaling
19-
class NsScaling< TnovaManager
19+
class NsScaling < TnovaManager
2020

2121
# @method post_ns_instances_scaling_out
2222
# @overload post "/ns-instances/scaling/:nsr_id/scale_out"
@@ -75,7 +75,7 @@ class NsScaling< TnovaManager
7575
# Autoscaling a Network service given a SLA breach in the monitoring
7676
# @param [string] nsr_id NS instance id
7777
post '/:nsr_id/auto_scale' do |nsr_id|
78-
logger.debug "Request for AUTO SCALE"
78+
logger.debug "#{nsr_id}: Request for AUTO SCALE"
7979

8080
return 415 unless request.content_type == 'application/json'
8181

@@ -98,7 +98,7 @@ class NsScaling< TnovaManager
9898
halt e.response.code, e.response.body
9999
end
100100

101-
logger.debug "Breach of parameter: " + auto_scale_info['parameter_id'].to_s
101+
logger.debug "#{nsr_id}: Breach detected of parameter: #{auto_scale_info['parameter_id'].to_s}"
102102

103103
flavour = nsr['service_deployment_flavour']
104104
halt 500, "Flavour not found for autoscale." if flavour.nil?
@@ -116,7 +116,7 @@ class NsScaling< TnovaManager
116116
halt 400, "No event defined for this scale request."
117117
end
118118

119-
logger.info "Breach detected in #{nsr_id}. Executing a #{event}"
119+
logger.info "#{nsr_id}: Executing a #{event}"
120120

121121
begin
122122
response = RestClient.post provisioner.host + "/ns-instances/scaling/#{nsr_id}/#{event}", "", 'X-Auth-Token' => provisioner.token, :content_type => :json
@@ -129,7 +129,7 @@ class NsScaling< TnovaManager
129129

130130
updateStatistics('auto_scaling_request_executed')
131131

132-
logger.debug "AutoScaling executed."
132+
logger.debug "#{nsr_id}: autoScaling executed."
133133
return response.code, response.body
134134
end
135135

ns-provisioning/helpers/mapping.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,23 @@ def replace_pop_name_by_pop_id(mapping, pops)
7676
end
7777
mapping
7878
end
79+
80+
def getMappingResponseWithPops(mapping)
81+
vnf_mapping = []
82+
mapping.each_pair do |vnf_id, pop_id|
83+
vnf_mapping << { 'maps_to_PoP' => "/pop/#{pop_id}", 'vnf' => '/' + vnf_id.to_s }
84+
end
85+
86+
mapping = {
87+
'links_mapping' =>
88+
[
89+
{
90+
'vld_id' => 'vld1',
91+
'maps_to_link' => '/pop/link/85b0bc34-dff0-4399-8435-4fb2ed65790a'
92+
}
93+
],
94+
'vnf_mapping' => vnf_mapping
95+
}
96+
mapping
97+
end
7998
end

0 commit comments

Comments
 (0)