sekharhuawei | 2af90a1 | 2020-08-17 17:54:53 +0530 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
| 3 | .. Copyright 2020 Huawei Technologies Co., Ltd. |
| 4 | |
| 5 | MSO-OPENSTACK-ADAPTER : |
| 6 | ======================= |
| 7 | |
| 8 | .. contents:: :depth: 3 |
| 9 | |
| 10 | Cloud site operations |
| 11 | ++++++++++++++++++++++ |
| 12 | * Here we have 3 api's createCloudRegion, updateCloudRegion, deleteCloudRegion. |
| 13 | |
| 14 | 1.Create Cloud site/Cloud region: |
| 15 | |
| 16 | Path: /v1/cloud-region |
| 17 | |
| 18 | Method Type: POST |
| 19 | |
| 20 | Request Body: |
| 21 | ************* |
| 22 | { |
| 23 | "id": "MTN13", |
| 24 | "regionId": "mtn13", |
| 25 | "cloudVersion": "3.0", |
| 26 | "clli": "MDT13", |
| 27 | "platform": "testFlatform", |
| 28 | "orchestrator": "testOrchestrator", |
| 29 | "cloudifyId": "mtn13", |
| 30 | "cloudOwner": "testCloudOwner", |
| 31 | |
| 32 | "identityService": { |
| 33 | "identityUrl": "testUrl", |
| 34 | "msoId": "admin", |
| 35 | "msoPass": "admin", |
| 36 | "projectDomainName": "testDomain", |
| 37 | "userDomainName": "testDomain", |
| 38 | "adminTenant": "test", |
| 39 | "memberRole": "test", |
| 40 | "tenantMetadata": "test", |
| 41 | "identityServerType": "test", |
| 42 | "identityAuthenticationType": "test", |
| 43 | "lastUpdatedBy": "test", |
| 44 | "created": "date", |
| 45 | "updated": "date" |
| 46 | |
| 47 | }, |
| 48 | |
| 49 | "identityServiceId": "123", |
| 50 | "lastUpdatedBy": "test", |
| 51 | "created": "test", |
| 52 | "updated": "test", |
| 53 | "supportFabric": "true", |
| 54 | "uri": "test" |
| 55 | |
| 56 | } |
| 57 | |
| 58 | * In this api we can create cloud region and cloud site and saving in catalog db and in AAI. |
| 59 | |
| 60 | * This api requires cloud-region-id and cloudSite as inputs. |
| 61 | |
| 62 | * In createCloudRegion two steps are there. |
| 63 | |
| 64 | * CreateRegionInCatalogDb(cloudSite) :- here we are creating cloud region in catalogdb if it is not exists in db(cloud_sites). |
| 65 | |
| 66 | * CreateCloudRegionInAAI(cloudSite) :- mapping cloudSite into cloudregion , this cloudregion we are creating in AAI and create CloudRegion NetworkTechnology Relationship. |
| 67 | |
| 68 | 2.Delete Cloud site: |
| 69 | |
| 70 | * Path:/v1/cloud-region/{cloud-region-id}/{cloud-owner} |
| 71 | |
| 72 | * Here we can delete Cloud site by cloud region id |
| 73 | |
| 74 | 3.Update Cloud site: |
| 75 | |
| 76 | * Path:/v1/cloud-region/{cloud-region-id}/{cloud-owner} |
| 77 | |
| 78 | * Here we can update Cloud site by cloud region id |
| 79 | |
| 80 | Create Tenant in Cloud: |
| 81 | ++++++++++++++++++++++++ |
| 82 | |
| 83 | Path: http://host:port/vnfs/rest/v1/tenants |
| 84 | |
| 85 | Method Type: POST |
| 86 | |
| 87 | Request Body: |
| 88 | ************* |
| 89 | |
| 90 | { |
| 91 | "cloudSiteId": "DAN", |
| 92 | "tenantName":"RAA_1", |
| 93 | "failIfExists": true, |
| 94 | "msoRequest": { |
| 95 | "requestId": "ra1", |
| 96 | "serviceInstanceId":"sa1" |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | RESPONSE: |
| 101 | ********** |
| 102 | |
| 103 | { |
| 104 | |
| 105 | "cloudSiteId": "DAN", |
| 106 | "tenantId": "128e10b9996d43a7874f19bbc4eb6749", |
| 107 | "tenantCreated": true, |
| 108 | "tenantRollback": { |
| 109 | "tenantId": "128e10b9996d43a7874f19bbc4eb6749", |
| 110 | "cloudId": "DAN", // RAA? cloudId instead of cloudSiteId |
| 111 | "tenantCreated": true, |
| 112 | "msoRequest": { |
| 113 | "requestId": "ra1", |
| 114 | "serviceInstanceId": "sa1" |
| 115 | |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | Code Flow: |
| 121 | |
| 122 | * Call to MSO createTenant adapter then call to catalog db for cloud site info and from cloud site get IdentityServerType. |
| 123 | * based on Cloud IdentityServerType it returns ORM or KEYSTONE Utils |
| 124 | * Query for a tenant with the specified name in the given cloud. If the tenant exists, return an MsoTenant object. If not, return null. |
| 125 | * Create a tenant with the specified name in the given cloud. If the tenant already exists, an Exception will be thrown. The MSO User will also be added to the "member" list of the new tenant to perform subsequent Nova/Heat commands in the tenant. If the MSO User association fails, the entire transaction will be rolled back. |
| 126 | |
| 127 | TaskServices |
| 128 | ++++++++++++++ |
| 129 | **1. CreateInventory** |
| 130 | |
| 131 | Flow Diagram: |
| 132 | |
| 133 | .. image :: ../images/InventoryCreate.png |
| 134 | |
| 135 | Code Flow: |
| 136 | |
| 137 | * Get cloud site using cloud region id from catalog db. |
| 138 | |
| 139 | * Instantiate heat bridge client by passing required values. |
| 140 | |
| 141 | * Authenticate heat bridge client. |
| 142 | |
| 143 | * If authentication is success we are getting all stack resources(openstack servers. servers contains openstack images and flavours.) |
| 144 | |
| 145 | * From stack resources we are getting osServers/ compute resources. |
| 146 | |
| 147 | * CreatePserversAndPinterfacesIfNotPresentInAai --Transform Openstack Server object to AAI Pserver object. create pserver in AAI if it is not exist. and get openstackresource id's / ports -- transform ports to pinterface Object in AAI. |
| 148 | |
| 149 | * After extract osimages and os flavours from osservers. |
| 150 | |
| 151 | * After that transform osimages to AAI images and osflavours to AAI flavors and add to AAI. |
| 152 | |
| 153 | * Create Vservers in AAI and make relationships to AAI image, AAI flavor, AAI pserver, vf-module. |
| 154 | |
| 155 | * Add Vservers and Linterfaces to AAI--Transform port to Linterface and for that port Get Ip addresses and updateLInterfaceIps and updateLInterfaceVlan. |
| 156 | |
| 157 | * Finally update AAI. |
| 158 | |
| 159 | **2. AuditCreateStack** |
| 160 | |
| 161 | Flow Diagram: |
| 162 | |
| 163 | .. image :: ../images/InventoryAddAudit.png |
| 164 | |
| 165 | Code Flow: |
| 166 | |
| 167 | * First we are capturing entry timestamp, MSO REQUESTID, Servicename/topic name,partnername as openstack adapter, invocation id is generating one random uuid. |
| 168 | |
| 169 | * After that getting auditInventory details from externalTask object |
| 170 | |
| 171 | * From auditInventory object we are getting cloud region,clowd owner,tenant id, heatstack name.these details we are passing to get AAIObjectAuditList. |
| 172 | |
| 173 | * Use cloudRegion, tenantId, heatStackName to get resources from Heat client. |
| 174 | |
| 175 | * To get resources we need heat client it means getting keystone url and token. |
| 176 | |
| 177 | * Get keystone url based on server type(keystone/keystonev3) |
| 178 | |
| 179 | * From resources object we are getting novaResources and resource groups and neutronPortDetails. |
| 180 | |
| 181 | * Create VserverSet by passing resources, novaResources, neutronPortDetails and setting up servers with ports to Set of Servers. |
| 182 | |
| 183 | * From resource groups we are getting Link(stackLink) from that link we are extracting resource path .if path is present we are Fetching nested Resource Stack Information. |
| 184 | |
| 185 | * audit all vservers,l-interfaces and sub l-interfaces. and checking in these vservers , l-interfaces and sub interfaces are existed or not in AAI. |
| 186 | |
| 187 | * If AAIObjectAuditList is present then we are setting audit type as create and Heat stack name to AAIObjectAuditList. |
| 188 | |
| 189 | * If Audit create success putting in variable to complete external task other wise sending exception. |
| 190 | |
| 191 | * If retrycount=1 sending error as retrycount exhausted. |
| 192 | |
| 193 | **3. AuditQueryStack** |
| 194 | |
| 195 | Flow Diagram: |
| 196 | |
| 197 | .. image :: ../images/InventoryQueryAudit.png |
| 198 | |
| 199 | |
| 200 | Code Flow: |
| 201 | |
| 202 | * Get AuditInventory details from external task. |
| 203 | |
| 204 | * Get AAIObjectAuditList from auditHeatStack by passing these parametersauditInventory.getCloudRegion(),auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName(). |
| 205 | |
| 206 | * Fetching Top Level Stack Information.i.e get all the heat model resources. |
| 207 | |
| 208 | * From heat model resources get all OS::Nova::Servers and OS::Heat::ResourceGroups and neutronPortDetails. |
| 209 | |
| 210 | * Once u got all the stack info u create vserverset and add that vserverset to AAIObjectAuditList. |
| 211 | |
| 212 | * After add AAIObjectAuditList to requestdb if it is not exist in requestdb. |
| 213 | |
| 214 | * If it is success complete the external task. |
| 215 | |
| 216 | **4. AuditDeleteStack** |
| 217 | |
| 218 | Flow Diagram: |
| 219 | |
| 220 | .. image :: ../images/InventoryDeleteAudit.png |
| 221 | |
| 222 | Code Flow: |
| 223 | |
| 224 | * Get AuditInventory details from external task |
| 225 | |
| 226 | * GetStackDataFromRequestDb usiing AuditInventory details. |
| 227 | |
| 228 | * Get RequestProcessingData from requestdb using auditInventory.getVfModuleId(),auditInventory.getHeatStackName(), "AuditStackData". |
| 229 | |
| 230 | * From RequestProcessingData get AAIObjectAuditList. |
| 231 | |
| 232 | * If AAIObjectAuditList is empty check vservers is exist or not in AAI and set that result as setDoesObjectExist(true/false). |
| 233 | |
| 234 | * Else Auditing Vservers based on vf module relationships--i.e based on genericVnfId and vfModuleName get all the vservers and create AAIObject and set setDoesObjectExist(true) and set that object to list. |
| 235 | |
| 236 | * After that set audit type as delete and heatstackname and check that audit create success or not. |
| 237 | |
| 238 | * If it is success complete the external task. |
| 239 | |
| 240 | **5. DeleteInventory** |
| 241 | |
| 242 | Flow Diagram: |
| 243 | |
| 244 | .. image :: ../images/DeleteInventory.png |
| 245 | |
| 246 | |
| 247 | Code Flow: |
| 248 | |
| 249 | * Get CloudInformation from external task. |
| 250 | |
| 251 | * First get CloudSite details from catalog db by using regionid. |
| 252 | |
| 253 | * From CloudSite get CloudIdentity details. |
| 254 | |
| 255 | * Create a heatbridgeclient. and authenticate the heatbridge. |
| 256 | |
| 257 | * After that delete the VFmodule data using vnfid and vf moduleid. |
| 258 | |
| 259 | * Once delete success complete the external task. |
| 260 | |
| 261 | **6. StackService** |
| 262 | |
| 263 | Flow Diagram: |
| 264 | |
| 265 | .. image :: ../images/OpenstackAdapterInvoke.png |
| 266 | |
| 267 | |
| 268 | Code Flow: |
| 269 | |
| 270 | * From external task getting openstackAdapterTaskRequest and adding to string(xmlRequest). |
| 271 | |
| 272 | * From xmlrequest we are getting requestType. |
| 273 | |
| 274 | 1. If requestType is createVolumeGroupRequest then we are creating volume group. |
| 275 | |
| 276 | * Marshalling xmlRequest to CreateVolumeGroupRequest. |
| 277 | |
| 278 | * From CreateVolumeGroupRequest getting completeVnfVfModuleType. |
| 279 | |
| 280 | * After that we are creating vf module by passing required paremeters. |
| 281 | |
| 282 | * If request type Start with X then we are orchestrating a VNF - *NOT* a module! |
| 283 | |
| 284 | * RequestType start with Volume then then we are sending true as volume request. |
| 285 | |
| 286 | * Creating a VnfRollback object by passing required parameters. |
| 287 | |
| 288 | * If nestedStackId is not null we are getting nested heat stack(stack information). |
| 289 | |
| 290 | * If nested heat stack is not null we are getting that output and storing into nestedVolumeOutputs object. |
| 291 | |
| 292 | * If nestedBaseStackId is not null we are getting nestedBaseHeatStack information and setting output to nestedBaseHeatStack. |
| 293 | |
| 294 | * If modelCustomizationUuid is available then with that mcu we are getting VFModuleCustomization(vfmc); |
| 295 | |
| 296 | * If we get VFModuleCustomization then we are extracting VfModule. |
| 297 | |
| 298 | * If vf version is not null then we will get vnfresource by passing vnftype and vnfversion. |
| 299 | |
| 300 | * By here - we would have either a vf or vnfResource. |
| 301 | |
| 302 | * If vf module is not null we are geting vnfresource from vf and from this vnfresource we are getting minversionvnf and maxversionvnf. |
| 303 | |
| 304 | * If minversionvnf and maxversionvnf are not null we are checking cloudConfig is null or not, if cloudConfig is not null then we are getting cloud site intormation by passing cloud site id. once we get the cloud site details we are getting min and max cloud site versions. |
| 305 | |
| 306 | * By the time we get here - heatTemplateId and heatEnvtId should be populated (or null) |
| 307 | |
| 308 | * If it is old way we will get heatTemplate directly. else if vf module is not null then |
| 309 | * If it is a volume request then we will get volumeheattemplate and volumeheatenvironment. |
| 310 | * If it is not a volume request then we will get ModuleHeatTemplate and HeatEnvironment. |
| 311 | |
| 312 | * Once we get heat templates we are getting nestedtemplates. |
| 313 | |
| 314 | * Also add the files: for any get_files associated with this vnf_resource_id |
| 315 | |
| 316 | * Add ability to turn on adding get_files with volume requests (by property). |
| 317 | |
| 318 | * If it is not a volume request get heat files from vf module. |
| 319 | |
| 320 | * CheckRequiredParameters in MsoVnfAdapterImpl.CHECK_REQD_PARAMS. |
| 321 | |
| 322 | * Parse envt entries to see if reqd parameter is there (before used a simple grep |
| 323 | |
| 324 | * Only submit to openstack the parameters in the envt that are in the heat template |
| 325 | |
| 326 | * Convert what we got as inputs (Map<String, String>) to a Map<String, Object> - where the object matches the param type identified in the template This will also not copy over params that aren't identified in the template |
| 327 | |
| 328 | * Now simply add the outputs as we received them - no need to convert to string |
| 329 | |
| 330 | * Add in the volume stack outputs if applicable |
| 331 | |
| 332 | * Get all heat template parameters and add to list. |
| 333 | |
| 334 | * Check for missing parameters null or not.if no missing parameters we can proceed for next step. |
| 335 | |
| 336 | * Next create stack with all required values. |
| 337 | |
| 338 | * After creating add heat stackname to vfrollback and copy heatstack outputs to outputs value. so now vf module is created successfully. |
| 339 | |
| 340 | * After sending the response to create volume group.once it is created that response we are setting to VolumeGroup response object. |
| 341 | |
| 342 | 2. If requestType is createVfModuleRequest then we are creating VfModule. |
| 343 | |
| 344 | * Marshalling xmlRequest to CreateVolumeGroupRequest. |
| 345 | |
| 346 | * From CreateVolumeGroupRequest getting completeVnfVfModuleType. |
| 347 | |
| 348 | * After that we are creating vf module by passing required paremeters. |
| 349 | |
| 350 | * If request type Start with X then we are orchestrating a VNF - *NOT* a module! |
| 351 | |
| 352 | * RequestType start with Volume then then we are sending true as volume request. |
| 353 | |
| 354 | * Creating a VnfRollback object by passing required parameters. |
| 355 | |
| 356 | * If nestedStackId is not null we are getting nested heat stack(stack information). |
| 357 | |
| 358 | * If nested heat stack is not null we are getting that output and storing into nestedVolumeOutputs object. |
| 359 | |
| 360 | * If nestedBaseStackId is not null we are getting nestedBaseHeatStack information and setting output to nestedBaseHeatStack. |
| 361 | |
| 362 | * If modelCustomizationUuid is available then with that mcu we are getting VFModuleCustomization(vfmc); |
| 363 | |
| 364 | * If we get VFModuleCustomization then we are extracting VfModule. |
| 365 | |
| 366 | * If vf version is not null then we will get vnfresource by passing vnftype and vnfversion. |
| 367 | |
| 368 | * By here - we would have either a vf or vnfResource. |
| 369 | |
| 370 | * If vf module is not null we are geting vnfresource from vf and from this vnfresource we are getting minversionvnf and maxversionvnf. |
| 371 | |
| 372 | * If minversionvnf and maxversionvnf are not null we are checking cloudConfig is null or not, if cloudConfig is not null then we are getting cloud site intormation by passing cloud site id. once we get the cloud site details we are getting min and max cloud site versions. |
| 373 | |
| 374 | * By the time we get here - heatTemplateId and heatEnvtId should be populated (or null) |
| 375 | |
| 376 | * If it is old way we will get heatTemplate directly. else if vf module is not null then |
| 377 | |
| 378 | * If it is a volume request then we will get volumeheattemplate and volumeheatenvironment. |
| 379 | |
| 380 | * If it is not a volume request then we will get ModuleHeatTemplate and HeatEnvironment. |
| 381 | |
| 382 | * Once we get heat templates we are getting nestedtemplates. |
| 383 | |
| 384 | * Also add the files: for any get_files associated with this vnf_resource_id |
| 385 | |
| 386 | * Add ability to turn on adding get_files with volume requests (by property). |
| 387 | |
| 388 | * If it is not a volume request get heat files from vf module. |
| 389 | |
| 390 | * CheckRequiredParameters in MsoVnfAdapterImpl.CHECK_REQD_PARAMS. |
| 391 | |
| 392 | * Parse envt entries to see if reqd parameter is there (before used a simple grep |
| 393 | |
| 394 | * Only submit to openstack the parameters in the envt that are in the heat template |
| 395 | |
| 396 | * Convert what we got as inputs (Map<String, String>) to a Map<String, Object> - where the object matches the param type identified in the template This will also not copy over params that aren't identified in the template |
| 397 | |
| 398 | * Now simply add the outputs as we received them - no need to convert to string |
| 399 | |
| 400 | * Add in the volume stack outputs if applicable |
| 401 | |
| 402 | * Get all heat template parameters and add to list. |
| 403 | |
| 404 | * Check for missing parameters null or not.if no missing parameters we can proceed for next step. |
| 405 | |
| 406 | * Next create stack with all required values. |
| 407 | |
| 408 | * After creating add heat stackname to vfrollback and copy heatstack outputs to outputs value. so now vf module is created successfully. |
| 409 | |
| 410 | 3. If requestType is deleteVfModuleRequest then we are deleting VfModule . |
| 411 | |
| 412 | * Get stackinfo using msoHeatUtils by passing cloudSiteId, cloudOwner, tenantId, vnfName parameters. |
| 413 | |
| 414 | * After that using modelCustomizationUuid we are getting VFModuleCustomizaiton--VFModule--heattemplate. |
| 415 | |
| 416 | * After that we are callling msoHeatUtils.deleteStack to delete StackInfo once it deletes we are updating status as deleted using msoHeatUtils.updateResourceStatus. |
| 417 | |
| 418 | 4. If requestType is deleteVolumeGroupRequest then we are deleting volume group. |
| 419 | |
| 420 | * Making DeleteVolumeGroupRequest by Unmarshalling xml request. |
| 421 | |
| 422 | * Getting stack information by passing stackName, cloudSiteId, tenantId. |
| 423 | |
| 424 | * If current stack is null then we confirm that heat status not found. |
| 425 | |
| 426 | * If current stack is not null then we are deleting the stack. |
| 427 | |
| 428 | * Once volumegroup is deleted we are setting the response to perticular response class. |
| 429 | |
| 430 | 5. If requestType is createNetworkRequest then we are creating network. |
| 431 | |
| 432 | * Making CreateNetworkRequest by Unmarshalling xmlrequest. |
| 433 | |
| 434 | * Check request is contrailRequest or not if it is contrailRequest we are setting shared,external,routeTargets,fqdns,routeTable values else we are setting physicalNetworkName and vlans. |
| 435 | |
| 436 | * Now all the above required values we are passing to create network. |
| 437 | |
| 438 | * Build a default NetworkRollback object (if no actions performed). |
| 439 | |
| 440 | * Getting the cloud site by passing cloudsite id. |
| 441 | |
| 442 | * After we are doing a network check and Retrieve the Network Resource definition. |
| 443 | |
| 444 | * If modelCustomizationUuid null and networkType is not null based on networkType we are getting Network Resource. |
| 445 | |
| 446 | * If modelCustomizationUuid not null then based on modelCustomizationUuid we are getting NetworkResourceCustomization and from that we are getting Network Resource. |
| 447 | |
| 448 | * If NetworkResourceCustomization is null then based on modelCustomizationUuid we are getting CollectionNetworkResourceCustomization and from that we are getting Network Resource. |
| 449 | |
| 450 | * Even though Network Resource is null we are sending error Unable to get network resource with NetworkType. |
| 451 | |
| 452 | * From the network resource we are extracting mode and network type. |
| 453 | |
| 454 | * All Networks are orchestrated via HEAT or Neutron if it is other than that we are sending error. |
| 455 | |
| 456 | * After that we are checking network resorce min and max versions with cloud site version if version is not supported throwing error. |
| 457 | |
| 458 | * After that validating the network parameters that if any parameter is missing. |
| 459 | |
| 460 | * Once we Retrieve the Network Resource we are getting heat template and NetworkType from that. |
| 461 | |
| 462 | * From the heat template we are getting template and checking that template contains os3nw if it is contains making flag is true. |
| 463 | |
| 464 | * First, look up to see if the Network already exists (by name).For HEAT orchestration of networks, the stack name will always match the network name |
| 465 | |
| 466 | * If stack is already exist with the network name throw an error. |
| 467 | |
| 468 | * After that from stackinfo get network id and network fqdn and get outputs from Stackinfo. |
| 469 | |
| 470 | * After that get subnetIdMap based on one subnet_id output or multiples subnet_%aaid% outputs from Stackinfo outputs. |
| 471 | |
| 472 | * After that update the updateResourceStatus as exits in requestdb. |
| 473 | |
| 474 | * Now we are Ready to deploy the new Network and Build the common set of HEAT template parameters |
| 475 | |
| 476 | * Validate (and update) the input parameters against the DB definition |
| 477 | |
| 478 | * Shouldn't happen unless DB config is wrong, since all networks use same inputs and inputs were already validated. |
| 479 | |
| 480 | * If subnets are not null and template is os3template then mergesubnetsAIC3. |
| 481 | |
| 482 | * If subnets are not null and template is not os3template then merge subnets. |
| 483 | |
| 484 | * If policyFqdns are not null & os3template true then mergePolicyRefs. |
| 485 | |
| 486 | * After that deploy the network stack-- create stack and once stack is created save into stackinfo. |
| 487 | |
| 488 | * For Heat-based orchestration, the MSO-tracked network ID is the heat stack, and the neutronNetworkId is the network UUID returned in stack outputs. |
| 489 | |
| 490 | * After update the resource status like network created successfully. |
| 491 | |
| 492 | * After set response to CreateNetworkResponse object. |
| 493 | |
| 494 | |
| 495 | 6. If requestType is deleteNetworkRequest then we are deleting network. |
| 496 | |
| 497 | * Form a DeleteNetworkRequest by unmarshlling Xml request. |
| 498 | |
| 499 | * check for mandatory fields networkId, cloudSiteId, tenantId. |
| 500 | |
| 501 | * If it is there Retrieve the Network Resource definition. |
| 502 | |
| 503 | * After that get networkResource.from networkResource get heat template. |
| 504 | |
| 505 | * After that delete stackinfo udpate resource status as deleted. |
| 506 | |
| 507 | 7. If requestType is updateNetworkRequest then we are updating Network. |
| 508 | |
| 509 | * Make UpdateNetworkRequest by unmarshalling xmlRequest. |
| 510 | |
| 511 | * Check the params contains key shared and external if it is contains get that shared and external keys. |
| 512 | |
| 513 | * Check the request is ContrailRequest or not, if it is ContrailRequest then get routeTargets , fqdns, routeTable from the actual request. |
| 514 | |
| 515 | * If it is not ContrailRequest then get the ProviderVlanNetwork details like physicalNetworkName and vlans. |
| 516 | |
| 517 | * Params to update network-req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(), physicalNetworkName,vlans, routeTargets, shared, external, req.getSubnets(), fqdns, routeTable, req.getMsoRequest(), subnetIdMap, networkRollback. |
| 518 | |
| 519 | * Update Network adapter with Network using networkName, networkType,cloudSiteId, tenantId. |
| 520 | |
| 521 | * Capture execution time for metrics. |
| 522 | |
| 523 | * Build a default rollback object (no actions performed) |
| 524 | |
| 525 | * Get cloud site details from catalog db using cloud site id. |
| 526 | |
| 527 | * If cloud site is not present send the error message like CloudSite does not exist in MSO Configuration. |
| 528 | |
| 529 | * Getting the cloud site by passing cloudsite id. |
| 530 | |
| 531 | * After we are doing a network check and Retrieve the Network Resource definition. |
| 532 | |
| 533 | * If modelCustomizationUuid null and networkType is not null based on networkType we are getting Network Resource. |
| 534 | |
| 535 | * If modelCustomizationUuid not null then based on modelCustomizationUuid we are getting NetworkResourceCustomization and from that we are getting Network Resource. |
| 536 | |
| 537 | * If NetworkResourceCustomization is null then based on modelCustomizationUuid we are getting CollectionNetworkResourceCustomization and from that we are getting Network Resource. |
| 538 | |
| 539 | * Even though Network Resource is null we are sending error Unable to get network resource with NetworkType. |
| 540 | |
| 541 | * From the network resource we are extracting mode and network type. |
| 542 | |
| 543 | * All Networks are orchestrated via HEAT or Neutron if it is other than that we are sending error. |
| 544 | |
| 545 | * After that we are checking network resorce min and max versions with cloud site version if version is not supported throwing error. |
| 546 | |
| 547 | * After that validating the network parameters that if any parameter is missing. |
| 548 | |
| 549 | * Once we Retrieve the Network Resource we are getting heat template and NetworkType from that. |
| 550 | |
| 551 | * Use an MsoNeutronUtils for all Neutron commands |
| 552 | |
| 553 | * If Orchestaration mode is NEUTRON Verify that the Network exists and For Neutron-based orchestration, the networkId is the Neutron Network UUID. |
| 554 | |
| 555 | * Get NetworkInfo from cloud site using networkId, tenantId, cloudSiteId as params. |
| 556 | |
| 557 | * If NetworkInfo is null then throw the error message as Network is does not exist. |
| 558 | |
| 559 | * Update the network in cloud site which is in catalog db using cloudSiteId,tenantId,networkId, neutronNetworkType, physicalNetworkName, vlans as params. |
| 560 | |
| 561 | * Add the network ID and previously queried vlans to the rollback object. |
| 562 | |
| 563 | * Save previous parameters such as NetworkName,PhysicalNetwork,Vlans to the NetworkRollback. |
| 564 | |
| 565 | * If Orchestaration mode is HEAT then First, look up to see that the Network already exists. For Heat-based orchestration, the networkId is the network Stack ID. |
| 566 | |
| 567 | * Get StackInfo by querystack using cloudSiteId, CLOUD_OWNER, tenantId, networkName. |
| 568 | |
| 569 | * If StackInfo is null throw error as Network not found else continue the flow. |
| 570 | |
| 571 | * Get the previous parameters such as previousNetworkName and previousPhysicalNetwork for rollback from StackInfo. |
| 572 | |
| 573 | * Get the previous vlans from the heat params and Update Stack with Previous VLANS. |
| 574 | |
| 575 | * Now we are Ready to deploy the updated Network via Heat. |
| 576 | |
| 577 | * Get the HeatTemplate from NetworkResource and now we got HEAT Template from DB. |
| 578 | |
| 579 | * Now get the OS::ContrailV2::VirtualNetwork property from property file , if template contains os3nw set flag as true. |
| 580 | |
| 581 | * Build the common set of HEAT template parameters such as neutronNetworkType, networkName, physicalNetworkName, vlans, routeTargets, shared, external, os3template. |
| 582 | |
| 583 | * Validate and update the input parameters against the DB definition and Shouldn't happen unless DB config is wrong, since all networks use same inputs. |
| 584 | |
| 585 | * If subnets are not null and template is os3template then mergesubnetsAIC3. |
| 586 | |
| 587 | * If subnets are not null and template is not os3template then merge subnets. |
| 588 | |
| 589 | * If policyFqdns are not null & os3template true then mergePolicyRefs. |
| 590 | |
| 591 | * If routeTableFqdns are not null os3template not null then mergeRouteTableRefs using routeTableFqdns, stackParams as params. |
| 592 | |
| 593 | * Get outputs from StackInfo and if key is contains subnet and os3template not null then one subnet output expected else multiples subnet outputs allowed. |
| 594 | |
| 595 | * Reach this point if createStack is successful.Populate remaining rollback info and response parameters and save previous parameters. |
| 596 | |
| 597 | * Now Network successfully updated via HEAT. |
| 598 | |
| 599 | 8. If requestType is rollbackNetworkRequest then we are doing rollbackNetwork. |
| 600 | |
| 601 | * Make RollbackNetworkRequest by unmarshalling xmlRequest. |
| 602 | |
| 603 | * Get NetworkRollback from RollbackNetworkRequest. |
| 604 | |
| 605 | * If pollForCompletion is null then set flag as true. |
| 606 | |
| 607 | * Get the elements of the VnfRollback object for easier access. |
| 608 | |
| 609 | * ROLLBACK Network using networkId, cloudSiteId, tenantId. |
| 610 | |
| 611 | * If NetworkCreated then use tenantId, CLOUD_OWNER, cloudSiteId, networkId, pollForCompletion, timeoutMinutes params to delete stack. |
| 612 | |
| 613 | * Once deletion is success set the response to RollbackNetworkResponse. |
| 614 | |
| 615 | * Once task stack service is success set the status completed for the external task. |
| 616 | |
| 617 | |
| 618 | **7. PollService** |
| 619 | |
| 620 | Flow Diagram: |
| 621 | |
| 622 | .. image :: ../images/OpenstackAdapterPoller.png |
| 623 | |
| 624 | |
| 625 | Code Flow: |
| 626 | |
| 627 | * Get openstackAdapterTaskRequest as xmlRequest from the the external task. |
| 628 | |
| 629 | * Get requestType from the xmlRequest. |
| 630 | |
| 631 | 1. If request type is createVolumeGroupRequest then Execute External Task Rollback Service for Create Volume Group. |
| 632 | |
| 633 | * Create CreateVolumeGroupRequest by unmarshalling xmlRequest. |
| 634 | |
| 635 | * Use CloudSiteId, CloudOwner, TenantId,VolumeGroupName, MsoRequest ,pollStackStatus as params to delete vnf. |
| 636 | |
| 637 | * Call to openstack to delete vnf if it is success nothing to return if it is failure return failure exception. |
| 638 | |
| 639 | * Once it is success set the boolean flags pollRollbackStatus and status as true. |
| 640 | |
| 641 | 2. If request type is createVfModuleRequest then Execute External Task Rollback Service for Create Vf Module. |
| 642 | |
| 643 | * Create CreateVfModuleRequest by unmarshalling xmlRequest. |
| 644 | |
| 645 | * Use CloudSiteId, CloudOwner, TenantId,VfModuleName, VnfId, VfModuleId, ModelCustomizationUuid,MsoRequest ,Holder as params to delete vf module. |
| 646 | |
| 647 | * Call to openstack to get the stack outputs. |
| 648 | |
| 649 | * If modelCustomizationUuid is not null then use as a param to get the VfModuleCustomization and from VfModuleCustomization get the vf module details. |
| 650 | |
| 651 | * Use tenantId, cloudOwner, cloudSiteId, vnfName, pollForCompletion, timeoutMinutes as params to delete the stack .once it is success update the resources. |
| 652 | |
| 653 | * Once it is success set the boolean flags pollRollbackStatus and status as true. |
| 654 | |
| 655 | 3. If requestType is deleteVfModuleRequest then Execute External Task Poll Service for Delete Vf Module. |
| 656 | |
| 657 | * Create DeleteVfModuleRequest by unmarshalling xmlRequest. |
| 658 | |
| 659 | * Get stackId from external task by using that get Stack. |
| 660 | |
| 661 | * Get pollingFrequency from properties file and calculate no.of polling attempts. |
| 662 | |
| 663 | * Using cloudSiteId, tenantId get Heatclient and once you got heatclient querystack to get the Stack object. |
| 664 | |
| 665 | * If Stack object is not null update the stack status in requestdb and it returns Stack object. |
| 666 | |
| 667 | * If Stack object is not null check the status is DELETE_COMPLETE then Stack Deletion completed successfully. |
| 668 | |
| 669 | |
| 670 | 4. If requestType is deleteVolumeGroupRequest then Execute Execute External Task Poll Service for Delete Volume Group. |
| 671 | |
| 672 | * Create DeleteVfModuleRequest by unmarshalling xmlRequest. |
| 673 | |
| 674 | * Get stackId from external task by using that get Stack. |
| 675 | |
| 676 | * Get pollingFrequency from properties file and calculate no.of polling attempts. |
| 677 | |
| 678 | * Using cloudSiteId, tenantId get Heatclient and once you got heatclient querystack to get the Stack object. |
| 679 | |
| 680 | * If Stack object is not null update the stack status in requestdb and it returns Stack object. |
| 681 | |
| 682 | * If Stack object is not null check the status is DELETE_COMPLETE then Stack Deletion completed successfully. |
| 683 | |
| 684 | 5. If requestType is deleteNetworkRequest then Execute External Task Poll Service for Delete Network. |
| 685 | |
| 686 | * Create DeleteVfModuleRequest by unmarshalling xmlRequest. |
| 687 | |
| 688 | * Get stackId from external task by using that get Stack. |
| 689 | |
| 690 | * Get pollingFrequency from properties file and calculate no.of polling attempts. |
| 691 | |
| 692 | * Using cloudSiteId, tenantId get Heatclient and once you got heatclient querystack to get the Stack object. |
| 693 | |
| 694 | * If Stack object is not null update the stack status in requestdb and it returns Stack object. |
| 695 | |
| 696 | * If Stack object is not null check the status is DELETE_COMPLETE then Stack Deletion completed successfully. |
| 697 | |
| 698 | 6. If requestType is createNetworkRequest then get the PollRollbackStatus from the external task. |
| 699 | |
| 700 | * If pollRollbackStatus is true then Execute External Task Poll Service for Rollback Create Network. |
| 701 | |
| 702 | * Get stackId from external task by using that get Stack. |
| 703 | |
| 704 | * Get pollingFrequency from properties file and calculate no.of polling attempts. |
| 705 | |
| 706 | * Using cloudSiteId, tenantId get Heatclient and once you got heatclient querystack to get the Stack object. |
| 707 | |
| 708 | * If Stack object is not null update the stack status in requestdb and it returns Stack object. |
| 709 | |
| 710 | * If Stack object is not null check the status is DELETE_COMPLETE then Stack Deletion completed successfully. |
| 711 | |
| 712 | * If pollRollbackStatus is false then Execute External Task Poll Service for Create Network. |
| 713 | |
| 714 | * Get stackId from external task by using that get Stack. |
| 715 | |
| 716 | * Get pollingFrequency from properties file and calculate no.of polling attempts. |
| 717 | |
| 718 | * Using cloudSiteId, tenantId get Heatclient and once you got heatclient querystack to get the Stack object. |
| 719 | |
| 720 | * If Stack object is not null update the stack status in requestdb and it returns Stack object. |
| 721 | |
| 722 | * If Stack object is not null check the status is CREATE_COMPLETE then Stack Creation completed successfully. |
| 723 | |
| 724 | 7. If requestType is createNetworkRequest then Execute External Task Rollback Service for Create Network. |
| 725 | |
| 726 | * Get stackId from external task by using that get Stack. |
| 727 | |
| 728 | * Get pollingFrequency from properties file and calculate no.of polling attempts. |
| 729 | |
| 730 | * Using cloudSiteId, tenantId get Heatclient and once you got heatclient querystack to get the Stack object. |
| 731 | |
| 732 | * If Stack object is not null update the stack status in requestdb and it returns Stack object. |
| 733 | |
| 734 | * If Stack object is not null check the status is UPDATE_COMPLETE then Stack Updation completed successfully. |
| 735 | |
| 736 | * Once task stack service is success set the status completed for the external task. |
| 737 | |
| 738 | **8. RollbackService** |
| 739 | |
| 740 | Flow Diagram: |
| 741 | |
| 742 | .. image :: ../images/OpenstackAdapterRollback.png |
| 743 | |
| 744 | |
| 745 | Code Flow: |
| 746 | |
| 747 | * Get openstackAdapterTaskRequest as xmlRequest from the the external task. |
| 748 | |
| 749 | * Get requestType from the xmlRequest. |
| 750 | |
| 751 | 1. If request type is createVolumeGroupRequest then Execute External Task Rollback Service for Create Volume Group. |
| 752 | |
| 753 | * Making DeleteVolumeGroupRequest by Unmarshalling xml request. |
| 754 | |
| 755 | * Getting stack information by passing stackName, cloudSiteId, tenantId. |
| 756 | |
| 757 | * If current stack is null then we confirm that heat status not found. |
| 758 | |
| 759 | * If current stack is not null then we are deleting the stack. |
| 760 | |
| 761 | * Once volumegroup is deleted we are setting the response to perticular response class. |
| 762 | |
| 763 | 2. If request type is createVfModuleRequest then Execute External Task Rollback Service for Create Vf Module. |
| 764 | |
| 765 | * Get stackinfo using msoHeatUtils by passing cloudSiteId, cloudOwner, tenantId, vnfName parameters. |
| 766 | |
| 767 | * After that using modelCustomizationUuid we are getting VFModuleCustomizaiton--VFModule--heattemplate. |
| 768 | |
| 769 | * After that we are callling msoHeatUtils.deleteStack to delete StackInfo once it deletes we are updating status as deleted using msoHeatUtils.updateResourceStatus. |
| 770 | |
| 771 | * Once it is success set the boolean flags pollRollbackStatus and status as true. |
| 772 | |
| 773 | 3. If request type is createNetworkRequest then Execute External Task Rollback Service for Create Network. |
| 774 | |
| 775 | * Form a DeleteNetworkRequest by unmarshlling Xml request. |
| 776 | |
| 777 | * Check for mandatory fields networkId, cloudSiteId, tenantId. |
| 778 | |
| 779 | * If it is there Retrieve the Network Resource definition. |
| 780 | |
| 781 | * After that get networkResource.from networkResource get heat template. |
| 782 | |
| 783 | * After that delete stackinfo udpate resource status as deleted. |
| 784 | |
| 785 | * Once task stack service is success set the status completed for the external task. |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 | |
| 791 | |
| 792 | |
| 793 | |
| 794 | |
| 795 | |
| 796 | |