Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 1 | ~~~ |
| 2 | ~~ ============LICENSE_START======================================================= |
Dan Timoney | 32f1614 | 2017-07-27 16:32:20 -0400 | [diff] [blame] | 3 | ~~ ONAP : CCSDK |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 4 | ~~ ================================================================================ |
Dan Timoney | 28fa1c9 | 2017-08-15 09:55:50 -0400 | [diff] [blame] | 5 | ~~ Copyright (C) 2017 AT&T Intellectual Property. All rights |
| 6 | ~~ reserved. |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 7 | ~~ ================================================================================ |
| 8 | ~~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | ~~ you may not use this file except in compliance with the License. |
| 10 | ~~ You may obtain a copy of the License at |
Dan Timoney | f84d3ea | 2017-08-11 20:12:41 -0400 | [diff] [blame] | 11 | ~~ |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 12 | ~~ http://www.apache.org/licenses/LICENSE-2.0 |
Dan Timoney | f84d3ea | 2017-08-11 20:12:41 -0400 | [diff] [blame] | 13 | ~~ |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 14 | ~~ Unless required by applicable law or agreed to in writing, software |
| 15 | ~~ distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | ~~ See the License for the specific language governing permissions and |
| 18 | ~~ limitations under the License. |
| 19 | ~~ ============LICENSE_END========================================================= |
| 20 | ~~~ |
| 21 | |
| 22 | --- |
| 23 | Service Logic Interpreter |
| 24 | --- |
| 25 | Dan Timoney |
| 26 | --- |
| 27 | 2014-11-12 |
| 28 | --- |
| 29 | |
| 30 | Supported node types |
| 31 | |
| 32 | The following built-in node types are currently supported: |
| 33 | |
| 34 | * Flow Control |
| 35 | |
| 36 | * {{{Block node}<<block>>}} |
| 37 | |
| 38 | * {{{Call node}<<call>>}} |
| 39 | |
| 40 | * {{{For node}<<for>>}} |
| 41 | |
| 42 | * {{{Return node}<<return>>}} |
| 43 | |
| 44 | * {{{Set node}<<set>>}} |
| 45 | |
| 46 | * {{{Switch node}<<switch>>}} |
| 47 | |
| 48 | * Device Management |
| 49 | |
| 50 | * {{{Configure node}<<configure>>}} |
| 51 | |
| 52 | * Java Plugin Support |
| 53 | |
| 54 | * {{{Execute node}<<execute>>}} |
| 55 | |
| 56 | * Recording |
| 57 | |
| 58 | * {{{Record node}<<record>>}} |
| 59 | |
| 60 | * Resource Management |
| 61 | |
| 62 | * {{{Delete node}<<delete>>}} |
| 63 | |
| 64 | * {{{Exists node}<<exists>>}} |
| 65 | |
| 66 | * {{{Get-resource node}<<get-resource>>}} |
| 67 | |
| 68 | * {{{Is-available node}<<is-available>>}} |
| 69 | |
| 70 | * {{{Notify node}<<notify>>}} |
| 71 | |
| 72 | * {{{Release node}<<release>>}} |
| 73 | |
| 74 | * {{{Reserve node}<<reserve>>}} |
| 75 | |
| 76 | * {{{Save node}<<save>>}} |
| 77 | |
| 78 | * {{{Update node}<<update>>}} |
| 79 | |
| 80 | |
| 81 | * Flow Control |
| 82 | |
| 83 | ** Block node |
| 84 | |
| 85 | *** Description |
| 86 | |
| 87 | A <<block>> node is used to executes a set of nodes. |
| 88 | |
| 89 | *** Attributes |
| 90 | |
| 91 | *--------------*--------------------------------------------+ |
| 92 | | <<atomic>> | if <true>, then if a node returns failure, subsequent nodes will not be executed and nodes already executed will be backed out. |
| 93 | *--------------*--------------------------------------------+ |
| 94 | |
| 95 | *** Parameters |
| 96 | |
| 97 | None |
| 98 | |
| 99 | *** Outcomes |
| 100 | |
| 101 | None |
| 102 | |
| 103 | *** Example |
| 104 | |
| 105 | +-----------------+ |
| 106 | <block> |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 107 | <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder"> |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 108 | <parameter name="file" value="/tmp/sample_r1.log" /> |
| 109 | <parameter name="field1" value="__TIMESTAMP__"/> |
| 110 | <parameter name="field2" value="RESERVED"/> |
| 111 | <parameter name="field3" value="$asePort.uni_circuit_id"/> |
| 112 | </record> |
| 113 | <return status="success"> |
| 114 | <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" /> |
| 115 | </return> |
| 116 | </block> |
| 117 | +-----------------+ |
| 118 | |
| 119 | |
| 120 | |
| 121 | **Call node |
| 122 | |
| 123 | *** Description |
| 124 | |
| 125 | A <<call>> node is used to call another graph |
| 126 | |
| 127 | *** Attributes |
| 128 | |
| 129 | *--------------*-------+ |
| 130 | | <<module>> | Module of directed graph to call. If unset, defaults to that of calling graph |
| 131 | *--------------*-------+ |
| 132 | | <<rpc>> | rpc of directed graph to call. |
| 133 | *--------------*-------+ |
| 134 | | <<version>> | version of graph to call, If unset, uses active version. |
| 135 | *--------------*-------+ |
| 136 | | <<mode>> | mode (sync/async) of graph to call. If unset, defaults to that of calling graph. |
| 137 | *--------------*-------+ |
| 138 | |
| 139 | |
| 140 | |
| 141 | *** Parameters |
| 142 | |
| 143 | Not applicable |
| 144 | |
| 145 | *** Outcomes |
| 146 | |
| 147 | *----------*---------+ |
| 148 | | <<success>> | Sub graph returned success |
| 149 | *----------*---------+ |
| 150 | | <<not-found>> | Graph not found |
| 151 | *----------*---------+ |
| 152 | | <<failure>> | Subgraph returned success |
| 153 | *----------*---------+ |
| 154 | . |
| 155 | |
| 156 | *** Example |
| 157 | |
| 158 | +-------------------+ |
| 159 | <call rpc="svc-topology-reserve" mode="sync" /> |
| 160 | +-------------------+ |
| 161 | |
| 162 | **For node |
| 163 | |
| 164 | *** Description |
| 165 | |
| 166 | A <<for>> node provides a fixed iteration looping mechanism, similar to the Java for loop |
| 167 | |
| 168 | *** Attributes |
| 169 | |
| 170 | *--------------*-------+ |
| 171 | | <<index>> | index variable |
| 172 | *--------------*-------+ |
| 173 | | <<start>> | initial value |
| 174 | *--------------*-------+ |
| 175 | | <<end>> | maximum value |
| 176 | *--------------*-------+ |
| 177 | |
| 178 | |
| 179 | *** Parameters |
| 180 | |
| 181 | Not applicable. |
| 182 | |
| 183 | *** Outcomes |
| 184 | |
| 185 | Not applicable. The <<status>> node has no outcomes. |
| 186 | |
| 187 | *** Example |
| 188 | |
| 189 | +-------------------+ |
| 190 | <for index="i" start="0" end="`$service-data.universal-cpe-ft.l2-switch-interfaces_length`"> |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 191 | <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder"> |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 192 | <parameter name="logger" value="message-log"/> |
| 193 | <parameter name="level" value="info"/> |
| 194 | <parameter name="field1" value="`'current l2-switch-interface name is ' + $service-data.universal-cpe-ft.l2-switch-interfaces[$i].name`"/> |
| 195 | </record> |
| 196 | </for> |
| 197 | +-------------------+ |
| 198 | |
| 199 | **Return node |
| 200 | |
| 201 | *** Description |
| 202 | |
| 203 | A <<return>> node is used to return a status to the invoking MD-SAL application |
| 204 | |
| 205 | *** Attributes |
| 206 | |
| 207 | *--------------*-------+ |
| 208 | | <<status>> | Status value to return (<success> or <failure>) |
| 209 | *--------------*-------+ |
| 210 | |
| 211 | |
| 212 | *** Parameters |
| 213 | |
| 214 | The following optional parameters may be passed to convey more |
| 215 | detailed status information. |
| 216 | |
| 217 | *------------*-----------+ |
| 218 | | <<error-code>> | A brief, usually numeric, code indicating the error condition |
| 219 | *------------*-----------+ |
| 220 | | <<error-message>> | A more detailed error message |
| 221 | *------------*-----------+ |
| 222 | |
| 223 | *** Outcomes |
| 224 | |
| 225 | Not applicable. The <<status>> node has no outcomes. |
| 226 | |
| 227 | *** Example |
| 228 | |
| 229 | +-------------------+ |
| 230 | <return status="failure"> |
| 231 | <parameter name="error-code" value="1542" /> |
| 232 | <parameter name="error-message" value="Activation failure" /> |
| 233 | </return> |
| 234 | +-------------------+ |
| 235 | |
| 236 | **Set node |
| 237 | |
| 238 | *** Description |
| 239 | |
| 240 | A <<set>> node is used to set one or more values in the execution context |
| 241 | |
| 242 | *** Attributes |
| 243 | |
| 244 | *--------------*-------+ |
| 245 | | <<only-if-unset>> | If true the set node will only execute if the current value of the target is null |
| 246 | *--------------*-------+ |
| 247 | |
| 248 | *** Parameters |
| 249 | |
| 250 | Values to be set are passed as parameters |
| 251 | |
| 252 | *** Outcomes |
| 253 | |
| 254 | Not applicable. The <<set>> node has no outcomes. |
| 255 | |
| 256 | *** Example |
| 257 | |
| 258 | +-------------------+ |
| 259 | <set> |
| 260 | <parameter name="vlan" value="$network.provider-segmentation-id" /> |
| 261 | </set> |
| 262 | +-------------------+ |
| 263 | |
| 264 | **Switch node |
| 265 | |
| 266 | *** Description |
| 267 | |
| 268 | A <<switch>> node is used to make a decision based on its <<test>> attribute. |
| 269 | |
| 270 | *** Attributes |
| 271 | |
| 272 | *--------------*-------+ |
| 273 | | <<test>> | Condition to test |
| 274 | *--------------*-------+ |
| 275 | |
| 276 | |
| 277 | *** Parameters |
| 278 | |
| 279 | None |
| 280 | |
| 281 | |
| 282 | *** Outcomes |
| 283 | |
| 284 | Depends on the <<test>> condition |
| 285 | |
| 286 | *** Example |
| 287 | |
| 288 | +-------------------+ |
| 289 | <switch test="$uni-cir-units"> |
| 290 | <outcome value="Mbps"> |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 291 | <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 292 | resource="ase-port" |
| 293 | key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value" |
| 294 | pfx="asePort"> |
| 295 | |
| 296 | <outcome value="success"> |
| 297 | <return status="success"> |
| 298 | <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" /> |
| 299 | </return> |
| 300 | </outcome> |
| 301 | <outcome value="Other"> |
| 302 | <return status="failure"> |
| 303 | <parameter name="error-code" value="1010" /> |
| 304 | <parameter name="error-message" value="No ports found that match criteria" /> |
| 305 | </return> |
| 306 | </outcome> |
| 307 | </reserve> |
| 308 | </outcome> |
| 309 | <outcome value="Gbps"> |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 310 | <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 311 | resource="ase-port" |
| 312 | key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value*1000" |
| 313 | pfx="asePort"> |
| 314 | |
| 315 | <outcome value="success"> |
| 316 | <return status="success"> |
| 317 | <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" /> |
| 318 | </return> |
| 319 | </outcome> |
| 320 | <outcome value="Other"> |
| 321 | <return status="failure"> |
| 322 | <parameter name="error-code" value="1010" /> |
| 323 | <parameter name="error-message" value="No ports found that match criteria" /> |
| 324 | </return> |
| 325 | </outcome> |
| 326 | </reserve> |
| 327 | </outcome> |
| 328 | </switch> |
| 329 | +-------------------+ |
| 330 | |
| 331 | * Device Management |
| 332 | |
| 333 | **Configure node |
| 334 | |
| 335 | *** Description |
| 336 | |
| 337 | A <<configure>> node is used to configure a device. |
| 338 | |
| 339 | *** Attributes |
| 340 | |
| 341 | *--------------*-------+ |
| 342 | | <<adaptor>> | Fully qualified Java class of resource adaptor to be used |
| 343 | *--------------*-------+ |
| 344 | | <<activate>> | Activate device/interface, for devices that support a separate activation step. |
| 345 | *--------------*-------+ |
| 346 | | <<key>> | SQL-like string specifying criteria for item to configure |
| 347 | *--------------*-------+ |
| 348 | |
| 349 | *** Parameters |
| 350 | |
| 351 | Specific to device adaptor. |
| 352 | |
| 353 | *** Outcomes |
| 354 | |
| 355 | *-----------*-------+ |
| 356 | | <<success>> | Device successfully configured |
| 357 | *-----------*-------+ |
| 358 | | <<not-found>> | Element to be configured does not exist. |
| 359 | *-----------*--------+ |
| 360 | | <<not-ready>> | Element is not in a state where it can be configured/activated |
| 361 | *-----------*-------+ |
| 362 | | <<already-active>> | Attempt to activate element that is already active |
| 363 | *-----------*-------+ |
| 364 | | <<failure>> | Configure failed for some other reason |
| 365 | *-----------*-------+ |
| 366 | |
| 367 | *** Example |
| 368 | |
| 369 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 370 | <configure adaptor="org.onap.ccsdk.sli.adaptors.emt.EmtAdaptor" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 371 | key="$uni-circuit-id" activate="true"> |
| 372 | <parameter name="circuit.id" value="$uni-circuit-id" /> |
| 373 | <parameter name="subscriber.name" value="$subscriber-name" /> |
| 374 | <parameter name="emt.clli" value="$edge-device-clli" /> |
| 375 | <parameter name="port.tagging" value="$port-tagging" /> |
| 376 | <parameter name="port.mediaSpeed" value="$media-speed" /> |
| 377 | <parameter name="location.state" value="$uni-location-state" /> |
| 378 | <parameter name="location.city" value="$uni-location-city" /> |
| 379 | <parameter name="cosCategory" value="$cos-category" /> |
| 380 | <parameter name="gosProfile" value="$gos-profile" /> |
| 381 | <parameter name="lldp" value="$asePort.resource-lldp" /> |
| 382 | <parameter name="mtu" value="$asePort.resource-mtu" /> |
| 383 | <outcome value="success"> |
| 384 | <block> |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 385 | <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder"> |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 386 | <parameter name="file" value="/tmp/sample_r1.log" /> |
| 387 | <parameter name="field1" value="__TIMESTAMP__"/> |
| 388 | <parameter name="field2" value="ACTIVE"/> |
| 389 | <parameter name="field3" value="$uni-circuit-id"/> |
| 390 | </record> |
| 391 | <return status="success"> |
| 392 | <parameter name="edge-device-clli" value="$asePort.resource-emt-clli" /> |
| 393 | </return> |
| 394 | </block> |
| 395 | </outcome> |
| 396 | <outcome value="already-active"> |
| 397 | <return status="failure"> |
| 398 | <parameter name="error-code" value="1590" /> |
| 399 | <parameter name="error-message" value="Port already active" /> |
| 400 | </return> |
| 401 | </outcome> |
| 402 | <outcome value="Other"> |
| 403 | <return status="failure"> |
| 404 | <parameter name="error-code" value="1542" /> |
| 405 | <parameter name="error-message" value="Activation failure" /> |
| 406 | </return> |
| 407 | </outcome> |
| 408 | </configure> |
| 409 | +-------------------+ |
| 410 | |
| 411 | * Java Plugin Support |
| 412 | |
| 413 | **Execute node |
| 414 | |
| 415 | *** Description |
| 416 | |
| 417 | An <<execute>> node is used to execute Java code supplied as a plugin |
| 418 | |
| 419 | *** Attributes |
| 420 | |
| 421 | *--------------*-------+ |
| 422 | | <<plugin>> | Fully qualified Java class of plugin to be used |
| 423 | *--------------*-------+ |
| 424 | | <<method>> | Name of method in the plugin class to execute. Method must return void, and take 2 arguments: a Map (for parameters) and a SvcLogicContext (to allow plugin read/write access to context memory) |
| 425 | *--------------*-------+ |
| 426 | |
| 427 | *** Parameters |
| 428 | |
| 429 | Specific to plugin / method |
| 430 | |
| 431 | *** Outcomes |
| 432 | |
| 433 | *-----------*-------+ |
| 434 | | <<success>> | Device successfully configured |
| 435 | *-----------*-------+ |
| 436 | | <<not-found>> | Plugin class could not be loaded |
| 437 | *-----------*--------+ |
| 438 | | <<unsupported-method>> | Named method taking (Map, SvcLogicContext) could not be found |
| 439 | *-----------*-------+ |
| 440 | | <<failure>> | Configure failed for some other reason |
| 441 | *-----------*-------+ |
| 442 | |
| 443 | *** Example |
| 444 | |
| 445 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 446 | <execute plugin="org.onap.ccsdk.sli.plugins.HelloWorld" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 447 | method="log"> |
| 448 | <parameter name="message" value="Hello, world!" /> |
| 449 | <outcome value="success"> |
| 450 | <return status="success"/> |
| 451 | </outcome> |
| 452 | <outcome value="not-found"> |
| 453 | <return status="failure"> |
| 454 | <parameter name="error-code" value="1590" /> |
| 455 | <parameter name="error-message" value="Could not locate plugin" /> |
| 456 | </return> |
| 457 | </outcome> |
| 458 | <outcome value="Other"> |
| 459 | <return status="failure"> |
| 460 | <parameter name="error-code" value="1542" /> |
| 461 | <parameter name="error-message" value="Internal error" /> |
| 462 | </return> |
| 463 | </outcome> |
| 464 | </execute> |
| 465 | +-------------------+ |
| 466 | |
| 467 | * Recording |
| 468 | |
| 469 | ** Record node |
| 470 | |
| 471 | *** Description |
| 472 | |
| 473 | A <<record>> node is used to record an event. For example, this might be used |
| 474 | to log provisioning events. |
| 475 | |
| 476 | *** Attributes |
| 477 | |
| 478 | *--------------*-------+ |
| 479 | | <<plugin>> | Fully qualified Java class to handle recording. |
| 480 | *--------------*-------+ |
| 481 | |
| 482 | |
| 483 | *** Parameters |
| 484 | |
| 485 | Parameters will depend on the plugin being used. For the FileRecorder class, |
| 486 | the parameters are as follows |
| 487 | |
| 488 | *------------*-----------+ |
| 489 | | <<file>> | The file to which the record should be written |
| 490 | *------------*-----------+ |
| 491 | | <<field1>> | First field to write. There will be <<field>> parameters for each field to write, from <<field1>> through <<fieldN>>. A special value __TIMESTAMP__ may be assigned to a field to insert the current timestamp |
| 492 | *------------*-----------+ |
| 493 | |
| 494 | |
| 495 | *** Outcomes |
| 496 | |
| 497 | *----------*---------+ |
| 498 | | <<success>> | Record successfully written |
| 499 | *----------*---------+ |
| 500 | | <<failure>> | Record could not be successfully written |
| 501 | *----------*---------+ |
| 502 | |
| 503 | *** Example |
| 504 | |
| 505 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 506 | <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder"> |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 507 | <parameter name="file" value="/tmp/sample_r1.log" /> |
| 508 | <parameter name="field1" value="__TIMESTAMP__"/> |
| 509 | <parameter name="field2" value="ACTIVE"/> |
| 510 | <parameter name="field3" value="$uni-circuit-id"/> |
| 511 | </record> |
| 512 | +-------------------+ |
| 513 | |
| 514 | * Resource Management |
| 515 | |
| 516 | ** Delete node |
| 517 | |
| 518 | *** Description |
| 519 | |
| 520 | A <<delete>> node is used to delete a resource from the local resource inventory. |
| 521 | |
| 522 | *** Attributes |
| 523 | |
| 524 | *--------------*-------+ |
| 525 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 526 | *--------------*-------+ |
| 527 | | <<resource>> | Type of resource to delete |
| 528 | *--------------*-------+ |
| 529 | | <<key>> | SQL-like string specifying key to delete |
| 530 | *--------------*-------+ |
| 531 | |
| 532 | *** Parameters |
| 533 | |
| 534 | None |
| 535 | |
| 536 | *** Outcomes |
| 537 | |
| 538 | *-----------*-------+ |
| 539 | | <<success>> | Resource specified deleted successfully. |
| 540 | *-----------*-------+ |
| 541 | | <failure>> | Resource specified was not deleted |
| 542 | *-----------*-------+ |
| 543 | |
| 544 | *** Example |
| 545 | |
| 546 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 547 | <delete plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 548 | resource="ase-port" |
| 549 | key="uni_circuit_id == $uni-circuit-id"> |
| 550 | <outcome value="true"> |
| 551 | <return status="success"/> |
| 552 | </outcome> |
| 553 | <outcome value="false"> |
| 554 | <return status="failure"/> |
| 555 | </outcome> |
| 556 | </delete> |
| 557 | +-------------------+ |
| 558 | |
| 559 | |
| 560 | ** Exists node |
| 561 | |
| 562 | *** Description |
| 563 | |
| 564 | An <<exists>> node is used to determine whether a particular |
| 565 | instance of a resource exists. For example, this might be |
| 566 | used to test whether a particular switch CLLI is provisioned. |
| 567 | |
| 568 | *** Attributes |
| 569 | |
| 570 | *--------------*-------+ |
| 571 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 572 | *--------------*-------+ |
| 573 | | <<resource>> | Type of resource to check |
| 574 | *--------------*-------+ |
| 575 | | <<key>> | SQL-like string specifying key to check for |
| 576 | *--------------*-------+ |
| 577 | |
| 578 | *** Parameters |
| 579 | |
| 580 | None |
| 581 | |
| 582 | *** Outcomes |
| 583 | |
| 584 | *-----------*-------+ |
| 585 | | <<true>> | Resource specified exists. |
| 586 | *-----------*-------+ |
| 587 | | <<false>> | Resource specified is unknown |
| 588 | *-----------*-------+ |
| 589 | |
| 590 | *** Example |
| 591 | |
| 592 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 593 | <exists plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 594 | resource="ase-port" |
| 595 | key="uni_circuit_id == $uni-circuit-id"> |
| 596 | <outcome value="true"> |
| 597 | <return status="success"/> |
| 598 | </outcome> |
| 599 | <outcome value="false"> |
| 600 | <return status="failure"/> |
| 601 | </outcome> |
| 602 | </exists> |
| 603 | +-------------------+ |
| 604 | |
| 605 | ** Get-resource node |
| 606 | |
| 607 | *** Description |
| 608 | |
| 609 | A <<get-resource>> node is used to retrieve information about a |
| 610 | particular resource and make it available to other nodes in the |
| 611 | service logic tree. For example, this might be used to |
| 612 | retrieve information about a particular uni-port. |
| 613 | |
| 614 | *** Attributes |
| 615 | |
| 616 | *--------------*-------+ |
| 617 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 618 | *--------------*-------+ |
| 619 | | <<resource>> | Type of resource to retrieve |
| 620 | *--------------*-------+ |
| 621 | | <<key>> | SQL-like string specifying criteria for retrieval |
| 622 | *--------------*-------+ |
| 623 | | <<pfx>> | Prefix to add to context variable names set for data retrieved |
| 624 | *--------------*-------+ |
| 625 | | <<select>> | String to specify, if key matches multiple entries, which entry should take precedence |
| 626 | *--------------*-------+ |
| 627 | | <<order-by>> | Prefix to add to context variable names set for data retrieved |
| 628 | *--------------*-------+ |
| 629 | |
| 630 | *** Parameters |
| 631 | |
| 632 | None |
| 633 | |
| 634 | |
| 635 | *** Outcomes |
| 636 | |
| 637 | *-----------*-------+ |
| 638 | | <<success>> | Resource successfully retrieved |
| 639 | *-----------*-------+ |
| 640 | | <<not-found>> | Resource referenced does not exist |
| 641 | *-----------*-------+ |
| 642 | | <<failure>> | Resource retrieve failed for some other reason |
| 643 | *-----------*-------+ |
| 644 | |
| 645 | *** Example |
| 646 | |
| 647 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 648 | <get-resource plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 649 | resource="ase-port" |
| 650 | key="uni_circuit_id == $uni-circuit-id" |
| 651 | pfx="current-port"> |
| 652 | <outcome value="success"> |
| 653 | <return status="success"/> |
| 654 | </outcome> |
| 655 | <outcome value="not-found"> |
| 656 | <return status="failure"/> |
| 657 | </outcome> |
| 658 | <outcome value="failure"> |
| 659 | <return status="failure"/> |
| 660 | </outcome> |
| 661 | </get-resource> |
| 662 | +-------------------+ |
| 663 | |
| 664 | ** Is-available node |
| 665 | |
| 666 | *** Description |
| 667 | |
| 668 | An <<is-available>> node is used to determine whether a particular |
| 669 | type of resource is available. For example, this might be used to |
| 670 | test whether any ports are available for assignment on a particular switch. |
| 671 | |
| 672 | *** Attributes |
| 673 | |
| 674 | *--------------*-------+ |
| 675 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 676 | *--------------*-------+ |
| 677 | | <<resource>> | Type of resource to check |
| 678 | *--------------*-------+ |
| 679 | | <<key>> | SQL-like string specifying key to check for |
| 680 | *--------------*-------+ |
| 681 | | <<pfx>> | Prefix to add to context variable names set for data retrieved |
| 682 | *--------------*-------+ |
| 683 | |
| 684 | *** Parameters |
| 685 | |
| 686 | None |
| 687 | |
| 688 | *** Outcomes |
| 689 | |
| 690 | *-----------*-------+ |
| 691 | | <<true>> | Resource requested is available |
| 692 | *-----------*-------+ |
| 693 | | <<false>> | Resource requested is not available |
| 694 | *-----------*-------+ |
| 695 | |
| 696 | *** Example |
| 697 | |
| 698 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 699 | <is-available plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 700 | resource="ase-port" |
| 701 | key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"> |
| 702 | <outcome value="true"> |
| 703 | <return status="success"/> |
| 704 | </outcome> |
| 705 | <outcome value="false"> |
| 706 | <return status="failure"/> |
| 707 | </outcome> |
| 708 | </is-available> |
| 709 | +-------------------+ |
| 710 | |
| 711 | ** Notify node |
| 712 | |
| 713 | *** Description |
| 714 | |
| 715 | A <<notify>> node is used to inform an external application (e.g. A&AI) that a resource was |
| 716 | updated. |
| 717 | |
| 718 | *** Attributes |
| 719 | |
| 720 | *--------------*-------+ |
| 721 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 722 | *--------------*-------+ |
| 723 | | <<resource>> | Identifies resource that was updated |
| 724 | *--------------*-------+ |
| 725 | | <<action>> | Action that triggered notification to be sent (ADD/UPDATE/DELETE) |
| 726 | *--------------*-------+ |
| 727 | |
| 728 | *** Parameters |
| 729 | |
| 730 | None |
| 731 | |
| 732 | *** Outcomes |
| 733 | |
| 734 | *-----------*-------+ |
| 735 | | <<success>> | Notification was successful |
| 736 | *-----------*-------+ |
| 737 | | <<failure>> | Notification failed is not available |
| 738 | *-----------*-------+ |
| 739 | |
| 740 | *** Example |
| 741 | |
| 742 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 743 | <notify plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 744 | resource="ase-port" |
| 745 | action="ADD"> |
| 746 | <outcome value="success"> |
| 747 | <return status="success"/> |
| 748 | </outcome> |
| 749 | <outcome value="Other"> |
| 750 | <return status="failure"/> |
| 751 | </outcome> |
| 752 | </notify> |
| 753 | +-------------------+ |
| 754 | |
| 755 | ** Release node |
| 756 | |
| 757 | *** Description |
| 758 | |
| 759 | A <<release>> node is used to mark a resource as no longer in use, and thus |
| 760 | available for assignment. |
| 761 | |
| 762 | *** Attributes |
| 763 | |
| 764 | *--------------*-------+ |
| 765 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 766 | *--------------*-------+ |
| 767 | | <<resource>> | Type of resource to release |
| 768 | *--------------*-------+ |
| 769 | | <<key>> | SQL-like string specifying key to check of resource to release |
| 770 | *--------------*-------+ |
| 771 | |
| 772 | *** Parameters |
| 773 | |
| 774 | None |
| 775 | |
| 776 | *** Outcomes |
| 777 | |
| 778 | *-----------*-------+ |
| 779 | | <<success>> | Resource successfully released |
| 780 | *-----------*-------+ |
| 781 | | <<not-found>> | Resource referenced does not exist |
| 782 | *-----------*-------+ |
| 783 | | <<failure>> | Resource release failed for some other reason |
| 784 | *-----------*-------+ |
| 785 | |
| 786 | *** Example |
| 787 | |
| 788 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 789 | <release plugin="org.onap.ccsdk.sli.adaptors.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 790 | resource="ase-port" |
| 791 | key="uni_circuit_id == $uni-circuit-id"> |
| 792 | <outcome value="success"> |
| 793 | <return status="success"/> |
| 794 | </outcome> |
| 795 | <outcome value="not-found"> |
| 796 | <return status="failure"/> |
| 797 | </outcome> |
| 798 | <outcome value="failure"> |
| 799 | <return status="failure"/> |
| 800 | </outcome> |
| 801 | </release> |
| 802 | +-------------------+ |
| 803 | |
| 804 | |
| 805 | ** Reserve node |
| 806 | |
| 807 | *** Description |
| 808 | |
| 809 | A <<reserve>> node is used to reserve a particular |
| 810 | type of resource.. For example, this might be used to |
| 811 | reserve a port on a particular switch. |
| 812 | |
| 813 | *** Attributes |
| 814 | |
| 815 | *--------------*-------+ |
| 816 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 817 | *--------------*-------+ |
| 818 | | <<resource>> | Type of resource to reserve |
| 819 | *--------------*-------+ |
| 820 | | <<key>> | SQL-like string specifying criteria for reservation |
| 821 | *--------------*-------+ |
| 822 | | <<select>> | String to specify, if <<key>> matches multiple entries, which entry should take precedence |
| 823 | *--------------*-------+ |
| 824 | |
| 825 | *** Parameters |
| 826 | |
| 827 | None |
| 828 | |
| 829 | *** Outcomes |
| 830 | |
| 831 | *-----------*-------+ |
| 832 | | <<success>> | Resource requested was successfully reserved |
| 833 | *-----------*-------+ |
| 834 | | <<failure>> | Resource requested was not successfully reserved |
| 835 | *-----------*-------+ |
| 836 | |
| 837 | *** Example |
| 838 | |
| 839 | +-------------------+ |
Dan Timoney | 41cdaaa | 2017-08-11 11:26:18 -0400 | [diff] [blame] | 840 | <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource" |
Dan Timoney | 2a93b9d | 2017-07-18 19:40:01 -0400 | [diff] [blame] | 841 | resource="ase-port" |
| 842 | key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value" |
| 843 | select="min(speed)"> |
| 844 | <outcome value="success"> |
| 845 | <return status="success"/> |
| 846 | </outcome> |
| 847 | <outcome value="failure"> |
| 848 | <return status="failure"/> |
| 849 | </outcome> |
| 850 | </reserve> |
| 851 | +-------------------+ |
| 852 | |
| 853 | ** Save node |
| 854 | |
| 855 | *** Description |
| 856 | |
| 857 | A <<save>> node is used to save information about a |
| 858 | particular resource to persistent storage. For example, this might be used to |
| 859 | save information about a particular uni-port. |
| 860 | |
| 861 | *** Attributes |
| 862 | |
| 863 | *--------------*-------+ |
| 864 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 865 | *--------------*-------+ |
| 866 | | <<resource>> | Type of resource to save |
| 867 | *--------------*-------+ |
| 868 | | <<key>> | SQL-like string specifying criteria for retrieval |
| 869 | *--------------*-------+ |
| 870 | | <<force>> | If "true", save resource even if this resource is already stored in persistent storage |
| 871 | *--------------*-------+ |
| 872 | | <<pfx>> | Prefix to be prepended to variable names, when attributes are set in SvcLogicContext |
| 873 | *--------------*-------+ |
| 874 | |
| 875 | *** Parameters |
| 876 | |
| 877 | Values to save (columns) are specified as parameters, with each name |
| 878 | corresponding to a column name and each value corresponding to the |
| 879 | value to set. |
| 880 | |
| 881 | *** Outcomes |
| 882 | |
| 883 | *-----------*-------+ |
| 884 | | <<success>> | Resource successfully saved |
| 885 | *-----------*-------+ |
| 886 | | <<failure>> | Resource save failed |
| 887 | *-----------*-------+ |
| 888 | |
| 889 | *** Example |
| 890 | |
| 891 | +-------------------+ |
| 892 | <save plugin="`$sample-resource-plugin`" resource="vnf" |
| 893 | key="vnf-name = $requests.vnf.vnf-name" force="true" |
| 894 | pfx="requests.vnf"> |
| 895 | <parameter name="vnf-name" |
| 896 | value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" /> |
| 897 | <parameter name="vnf-type" value="vce" /> |
| 898 | <parameter name="orchestration-status" value="pending-create" /> |
| 899 | <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" /> |
| 900 | <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" /> |
| 901 | <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" /> |
| 902 | </save> |
| 903 | +-------------------+ |
| 904 | |
| 905 | ** Update node |
| 906 | |
| 907 | *** Description |
| 908 | |
| 909 | An <<update>> node is used to update information about a |
| 910 | particular resource to persistent storage. |
| 911 | |
| 912 | *** Attributes |
| 913 | |
| 914 | *--------------*-------+ |
| 915 | | <<plugin>> | Fully qualified Java class of resource adaptor to be used |
| 916 | *--------------*-------+ |
| 917 | | <<resource>> | Type of resource to update |
| 918 | *--------------*-------+ |
| 919 | | <<key>> | SQL-like string specifying criteria for retrieval |
| 920 | *--------------*-------+ |
| 921 | | <<pfx>> | Prefix to be prepended to variable names, when attributes are set in SvcLogicContext |
| 922 | *--------------*-------+ |
| 923 | |
| 924 | *** Parameters |
| 925 | |
| 926 | Values to save (columns) are specified as parameters, with each name |
| 927 | corresponding to a column name and each value corresponding to the |
| 928 | value to set. |
| 929 | |
| 930 | *** Outcomes |
| 931 | |
| 932 | *-----------*-------+ |
| 933 | | <<success>> | Resource successfully saved |
| 934 | *-----------*-------+ |
| 935 | | <<failure>> | Resource save failed |
| 936 | *-----------*-------+ |
| 937 | |
| 938 | *** Example |
| 939 | |
| 940 | +-------------------+ |
| 941 | <update plugin="`$sample-resource-plugin`" resource="vnf" |
| 942 | key="vnf-name = $requests.vnf.vnf-name" |
| 943 | pfx="requests.vnf"> |
| 944 | <parameter name="vnf-name" |
| 945 | value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" /> |
| 946 | <parameter name="vnf-type" value="vce" /> |
| 947 | <parameter name="orchestration-status" value="pending-create" /> |
| 948 | <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" /> |
| 949 | <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" /> |
| 950 | <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" /> |
| 951 | </update> |
| 952 | +-------------------+ |
| 953 | |