talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 1 | /*! |
| 2 | * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 13 | * or implied. See the License for the specific language governing |
| 14 | * permissions and limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | import keyMirror from 'nfvo-utils/KeyMirror.js'; |
| 18 | |
| 19 | export const actionTypes = keyMirror({ |
| 20 | LOAD_CONFLICTS: null, |
| 21 | ADD_ACTIONS: null, |
| 22 | LOAD_CONFLICT: null, |
| 23 | DATA_PROCESSED: null |
| 24 | }); |
| 25 | |
| 26 | export const rules = { |
| 27 | SKIP: 'skip', |
| 28 | PARSE: 'parse', |
| 29 | FUNCTION: 'function', |
| 30 | BOOLEAN: 'boolean' |
| 31 | }; |
| 32 | |
| 33 | export const SyncStates = { |
| 34 | MERGE : 'Merging', |
| 35 | OUT_OF_SYNC: 'OutOfSync', |
| 36 | UP_TO_DATE: 'UpToDate' |
| 37 | }; |
| 38 | |
| 39 | export const ResolutionTypes = { |
| 40 | YOURS: 'YOURS', |
| 41 | THEIRS: 'THEIRS' |
| 42 | }; |
| 43 | |
| 44 | export const fileTypes = { |
| 45 | LKG : 'LicenseKeyGroup', |
| 46 | VLM : 'VendorLicenseModel', |
| 47 | EP : 'EntitlementPool', |
| 48 | FG : 'FeatureGroup', |
| 49 | LA : 'LicenseAgreement', |
| 50 | VSP : 'VendorSoftwareProduct', |
| 51 | LIMIT : 'Limit', |
| 52 | VSP_Q : 'VSPQuestionnaire', |
| 53 | COMPONENT : 'Component', |
| 54 | COMPONENT_Q : 'ComponentQuestionnaire', |
| 55 | COMPONENT_DEP : 'ComponentDependencies', |
| 56 | COMPUTE_Q : 'ComputeQuestionnaire', |
| 57 | COMPUTE : 'Compute', |
| 58 | COMPUTE_FLAVOR: 'ComputeFlavor', |
| 59 | NIC : 'Nic', |
| 60 | NIC_Q : 'NicQuestionnaire', |
| 61 | IMAGE : 'Image', |
| 62 | IMAGE_Q : 'ImageQuestionnaire', |
| 63 | PROCESS : 'Process', |
| 64 | DEPLOYMENT_FLAVOR : 'DeploymentFlavor', |
| 65 | VENDOR : 'Vendor', |
| 66 | NETWORK : 'Network', |
| 67 | ORCHESTRATION_TEMPLATE_CANDIDATE : 'OrchestrationTemplateCandidate' |
| 68 | }; |
| 69 | |
| 70 | export const dataRules = { |
| 71 | general: { |
| 72 | id: { |
| 73 | rule: rules.SKIP |
| 74 | }, |
| 75 | questionareData: { |
| 76 | rule: rules.PARSE, |
| 77 | moveFields: true |
| 78 | }, |
| 79 | startDate: { |
| 80 | rule: rules.FUNCTION, |
| 81 | functionName: 'parseDate' |
| 82 | }, |
| 83 | expiryDate: { |
| 84 | rule: rules.FUNCTION, |
| 85 | functionName: 'parseDate' |
| 86 | }, |
| 87 | featureGroups: { |
| 88 | rule: rules.FUNCTION, |
| 89 | functionName: 'reduceList', |
| 90 | args: {subField: 'name'} |
| 91 | }, |
| 92 | licenseKeyGroups: { |
| 93 | rule: rules.FUNCTION, |
| 94 | functionName: 'reduceList', |
| 95 | args: {subField: 'name'} |
| 96 | }, |
| 97 | entitlementPools: { |
| 98 | rule: rules.FUNCTION, |
| 99 | functionName: 'reduceList', |
| 100 | args: {subField: 'name'} |
| 101 | }, |
| 102 | }, |
| 103 | [fileTypes.COMPONENT] : { |
| 104 | }, |
| 105 | [fileTypes.COMPUTE_FLAVOR] : { |
| 106 | associatedToDeploymentFlavor: { |
| 107 | rule: rules.BOOLEAN, |
| 108 | trueValue: 'true' |
| 109 | } |
| 110 | }, |
| 111 | [fileTypes.COMPUTE_Q] : { |
| 112 | }, |
| 113 | [fileTypes.COMPONENT_Q] : { |
| 114 | isComponentMandatory: { |
| 115 | rule: rules.BOOLEAN, |
| 116 | trueValue: 'YES', |
| 117 | falseValue: 'NO' |
| 118 | } |
| 119 | }, |
| 120 | [fileTypes.EP] : { |
| 121 | referencingFeatureGroups: { |
| 122 | rule: rules.SKIP, |
| 123 | functionName: 'getFeatureGroups' |
| 124 | }, |
| 125 | operationalScope: { |
| 126 | rule: rules.FUNCTION, |
| 127 | functionName: 'processChoices' |
| 128 | }, |
| 129 | }, |
| 130 | [fileTypes.FG] : { |
| 131 | referencingLicenseAgreements: { |
| 132 | rule: rules.SKIP, |
| 133 | functionName: 'getLicenseAgreements' |
| 134 | } |
| 135 | }, |
| 136 | [fileTypes.LA] : { |
| 137 | licenseTerm : { |
| 138 | rule: rules.FUNCTION, |
| 139 | functionName: 'processChoice' |
| 140 | } |
| 141 | }, |
| 142 | [fileTypes.LIMIT] : { |
| 143 | type: { |
| 144 | rule: rules.FUNCTION, |
| 145 | functionName: 'getEnumValue', |
| 146 | args: {listName: 'limitType'} |
| 147 | }, |
| 148 | unit: { |
| 149 | rule: rules.FUNCTION, |
| 150 | functionName: 'getEnumValue', |
| 151 | args: {listName: 'limitUnit'} |
| 152 | } |
| 153 | }, |
| 154 | [fileTypes.LKG] : { |
| 155 | operationalScope: { |
| 156 | rule: rules.FUNCTION, |
| 157 | functionName: 'processChoices' |
| 158 | }, |
| 159 | referencingFeatureGroups: { |
| 160 | rule: rules.SKIP, |
| 161 | functionName: 'getFeatureGroups' |
| 162 | }, |
| 163 | }, |
| 164 | [fileTypes.NIC] : { |
| 165 | networkId: { |
| 166 | rule: rules.SKIP |
| 167 | } |
| 168 | }, |
| 169 | [fileTypes.NIC_Q] : { |
| 170 | }, |
| 171 | [fileTypes.PROCESS] : { |
| 172 | type: { |
| 173 | rule: rules.FUNCTION, |
| 174 | functionName: 'getEnumValue', |
| 175 | args: {listName: 'processType'} |
| 176 | } |
| 177 | }, |
| 178 | [fileTypes.VLM] : { |
| 179 | iconRef: { |
| 180 | rule: rules.SKIP |
| 181 | } |
| 182 | }, |
| 183 | [fileTypes.VSP] : { |
| 184 | vendorId: { |
| 185 | rule: rules.SKIP |
| 186 | }, |
| 187 | onboardingMethod: { |
| 188 | rule: rules.SKIP |
| 189 | }, |
| 190 | validationData: { |
| 191 | rule: rules.SKIP |
| 192 | }, |
| 193 | isOldVersion: { |
| 194 | rule: rules.SKIP |
| 195 | }, |
| 196 | licensingVersion: { |
| 197 | rule: rules.FUNCTION, |
| 198 | functionName: 'fetchLMVersion' |
| 199 | }, |
| 200 | category: { |
| 201 | rule: rules.FUNCTION, |
| 202 | functionName: 'fetchCategory' |
| 203 | }, |
| 204 | subCategory: { |
| 205 | rule: rules.SKIP |
| 206 | }, |
| 207 | }, |
| 208 | [fileTypes.VSP_Q] : { |
| 209 | affinityData: { |
| 210 | rule: rules.SKIP |
| 211 | }, |
| 212 | storageReplicationAcrossRegion: { |
| 213 | rule: rules.BOOLEAN, |
| 214 | trueValue: 'true', |
| 215 | falseValue: 'false' |
| 216 | } |
| 217 | }, |
| 218 | [fileTypes.ORCHESTRATION_TEMPLATE_CANDIDATE] : { |
| 219 | modules: { |
| 220 | rule: rules.FUNCTION, |
| 221 | functionName: 'convertArrayToObject' |
| 222 | }, |
| 223 | }, |
| 224 | }; |