Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 5.54 KB | None | 0 0
  1. Class:
  2. #  Licensed under the Apache License, Version 2.0 (the "License"); you may
  3. #  not use this file except in compliance with the License. You may obtain
  4. #  a copy of the License at
  5. #
  6. #       http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. #  Unless required by applicable law or agreed to in writing, software
  9. #  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  10. #  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  11. #  License for the specific language governing permissions and limitations
  12. #  under the License.
  13.  
  14. Namespaces:
  15.   =: gov.pnnl.apps.visr
  16.   pnnl: gov.pnnl.apps
  17.   std: io.murano
  18.   res: io.murano.resources
  19.   sys: io.murano.system
  20.  
  21. Name: ViSRWindowsWorkstation
  22.  
  23. Extends: std:Application
  24.  
  25. Properties:
  26.   instance:
  27.     Contract: $.class(res:WindowsInstance).notNull()
  28.  
  29. Methods:
  30.   initialize:
  31.     Body:
  32.       - $._environment: $.find(std:Environment).require()
  33.  
  34.   deploy:
  35.     Body:
  36.      - $.super($.deploy())
  37.  
  38.       - If: not $.getAttr(hostDeployed, false)
  39.         Then:
  40.          - $._environment.reporter.report($this, 'Creating VM for ViSR Windows Workstation')
  41.           - $.instance.deploy()
  42.           - $._environment.reporter.report($this, 'Instance is created.')
  43.  
  44.           - If: $.instance.assignFloatingIp
  45.             Then:
  46.               - $host: $.instance.floatingIpAddress
  47.             Else:
  48.               - $host: $.instance.ipAddresses[0]
  49.           - $._environment.reporter.report($this, format('Workstation is available at {0}', $host))
  50.           - $.setAttr(deployed, true)
  51.  
  52.           - Return:
  53.      - $.setAttr(hostDeployed, true)
  54.  
  55.  
  56. UI:
  57. #  Licensed under the Apache License, Version 2.0 (the "License"); you may
  58. #  not use this file except in compliance with the License. You may obtain
  59. #  a copy of the License at
  60. #
  61. #       http://www.apache.org/licenses/LICENSE-2.0
  62. #
  63. #  Unless required by applicable law or agreed to in writing, software
  64. #  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  65. #  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  66. #  License for the specific language governing permissions and limitations
  67. #  under the License.
  68.  
  69. Version: 2.2
  70.  
  71. Templates:
  72.   customJoinNet:
  73.     - ?:
  74.         type: io.murano.resources.ExistingNeutronNetwork
  75.       internalNetworkName: $.instanceConfiguration.network[0]
  76.       internalSubnetworkName: $.instanceConfiguration.network[1]
  77.  
  78. Application:
  79.   ?:
  80.     type: gov.pnnl.apps.visr.ViSRWindowsWorkstation
  81.   instance:
  82.     ?:
  83.       type: io.murano.resources.WindowsInstance
  84.     name: generateHostname($.instanceConfiguration.unitNamingPattern,1)
  85.     flavor: $.instanceConfiguration.flavor
  86.     image: $.instanceConfiguration.osImage
  87.     keyname: $.instanceConfiguration.keyPair
  88.     availabilityZone: $.instanceConfiguration.availabilityZone
  89.     assignFloatingIp: $.appConfiguration.assignFloatingIP
  90.     networks:
  91.       useEnvironmentNetwork: $.instanceConfiguration.network[0]=null
  92.       useFlatNetwork: false
  93.       customNetworks: switch($.instanceConfiguration.network[0], $=null=>list(), $!=null=>$customJoinNet)
  94.  
  95. Forms:
  96.   - appConfiguration:
  97.       fields:
  98.         - name: license
  99.           type: string
  100.           description: Apache License, Version 2.0
  101.           hidden: true
  102.           required: false
  103.         - name: assignFloatingIP
  104.           type: boolean
  105.           label: Assign Floating IP
  106.           description: >-
  107.              Select to true to assign floating IP automatically
  108.           initial: false
  109.           required: false
  110.  
  111.    
  112.   - instanceConfiguration:
  113.       fields:
  114.         - name: title
  115.           type: string
  116.           required: false
  117.           hidden: true
  118.           description: Specify instance parameters for the worker workstations.
  119.         - name: flavor
  120.           type: flavor
  121.           label: Instance flavor
  122.           description: >-
  123.             Select registered in Openstack flavor. Consider that application performance
  124.             depends on this parameter.
  125.           required: false
  126.         - name: osImage
  127.           type: image
  128.           imageType: windows
  129.           label: Instance image
  130.           description: >-
  131.             Select valid image for the application. Image should already be prepared and
  132.             registered in glance.
  133.         - name: keyPair
  134.           type: keypair
  135.           label: Key Pair
  136.           description: >-
  137.             Select the Key Pair to control access to instances. You can login to
  138.             instances using this KeyPair after the deployment of application.
  139.           required: false
  140.         - name: availabilityZone
  141.           type: azone
  142.           label: Availability zone
  143.           description: Select availability zone where application would be installed.
  144.           required: false
  145.         - name: network
  146.           type: network
  147.           label: Network
  148.           description: Select a network to join. 'Auto' corresponds to a default environment's network.
  149.           required: false
  150.           murano_networks: translate
  151.         - name: unitNamingPattern
  152.           type: string
  153.           label: Instance Naming Pattern
  154.           required: false
  155.           maxLength: 64
  156.           regexpValidator: '^[a-zA-z][-_\w]*$'
  157.           errorMessages:
  158.             invalid: Just letters, numbers, underscores and hyphens are allowed.
  159.           helpText: Just letters, numbers, underscores and hyphens are allowed.
  160.           description: >-
  161.             Specify a string, that will be used in instance hostname.
  162.             Just A-Z, a-z, 0-9, dash and underline are allowed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement