Matteo Scandolo | fcf842e | 2017-08-08 13:05:25 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 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 or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Matteo Scandolo | ddce4ec | 2016-09-26 13:11:03 -0700 | [diff] [blame] | 17 | from xosresource import XOSResource |
Zack Williams | c8e1462 | 2016-10-05 17:59:56 -0700 | [diff] [blame] | 18 | from service import XOSService |
| 19 | from services.metronetwork.models import * |
Matteo Scandolo | 770c49f | 2016-09-23 15:07:38 -0700 | [diff] [blame] | 20 | |
Matteo Scandolo | 9563aeb | 2016-09-28 16:07:58 -0700 | [diff] [blame] | 21 | class XOSMetroNetworkSystem(XOSResource): |
| 22 | provides = "tosca.nodes.MetroNetworkSystem" |
| 23 | xos_model = MetroNetworkSystem |
| 24 | copyin_props = ["name", "administrativeState", "restUrl"] |
Matteo Scandolo | ddce4ec | 2016-09-26 13:11:03 -0700 | [diff] [blame] | 25 | |
| 26 | class MetroNetworkDevice(XOSResource): |
| 27 | provides = "tosca.nodes.MetroNetworkDevice" |
| 28 | xos_model = NetworkDevice |
Matteo Scandolo | 9563aeb | 2016-09-28 16:07:58 -0700 | [diff] [blame] | 29 | copyin_props = ["id", "name", "administrativeState", "username", "password", "authType", "restCtrlUrl"] |
Andrea Campanella | e92c909 | 2017-03-17 10:44:37 +0100 | [diff] [blame] | 30 | |
| 31 | class VnodGlobalService(XOSService): |
| 32 | provides = "tosca.nodes.VNodGlobalService" |
| 33 | xos_model = VnodGlobalService |
| 34 | copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber"] |
| 35 | |
| 36 | def get_xos_args(self): |
| 37 | args = super(VnodGlobalService, self).get_xos_args() |
| 38 | |
| 39 | profile = self.get_requirement("tosca.relationships.UsesBandwidthProfile", throw_exception=False) |
| 40 | if profile: |
| 41 | profile = self.get_xos_object(BandwidthProfile, name=profile) |
| 42 | args["bandwidthProfile"] = profile |
| 43 | return args |
| 44 | |
| 45 | class XOSMetronetBandwithProficle(XOSResource): |
| 46 | provides = "tosca.nodes.EcordBandwidthProfile" |
| 47 | xos_model = BandwidthProfile |
Andrea Campanella | 1123755 | 2017-03-21 17:21:20 +0100 | [diff] [blame] | 48 | copyin_props = ['bwpcfgcbs','bwpcfgebs','bwpcfgcir','bwpcfgeir','name'] |
| 49 | |
| 50 | class XOSMetronetUNI(XOSResource): |
| 51 | provides = "tosca.nodes.EcordUserNetworkInterface" |
| 52 | xos_model = UserNetworkInterface |
| 53 | copyin_props = ['enabled','capacity','bw_used','vlanIds', 'location', 'latlng', 'name'] |