blob: 9322d61205099e38e984a2df3cfe93e0f3d5e32a [file] [log] [blame]
Matteo Scandolofcf842e2017-08-08 13:05:25 -07001
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 Scandoloddce4ec2016-09-26 13:11:03 -070017from xosresource import XOSResource
Zack Williamsc8e14622016-10-05 17:59:56 -070018from service import XOSService
19from services.metronetwork.models import *
Matteo Scandolo770c49f2016-09-23 15:07:38 -070020
Matteo Scandolo9563aeb2016-09-28 16:07:58 -070021class XOSMetroNetworkSystem(XOSResource):
22 provides = "tosca.nodes.MetroNetworkSystem"
23 xos_model = MetroNetworkSystem
24 copyin_props = ["name", "administrativeState", "restUrl"]
Matteo Scandoloddce4ec2016-09-26 13:11:03 -070025
26class MetroNetworkDevice(XOSResource):
27 provides = "tosca.nodes.MetroNetworkDevice"
28 xos_model = NetworkDevice
Matteo Scandolo9563aeb2016-09-28 16:07:58 -070029 copyin_props = ["id", "name", "administrativeState", "username", "password", "authType", "restCtrlUrl"]
Andrea Campanellae92c9092017-03-17 10:44:37 +010030
31class 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
45class XOSMetronetBandwithProficle(XOSResource):
46 provides = "tosca.nodes.EcordBandwidthProfile"
47 xos_model = BandwidthProfile
Andrea Campanella11237552017-03-21 17:21:20 +010048 copyin_props = ['bwpcfgcbs','bwpcfgebs','bwpcfgcir','bwpcfgeir','name']
49
50class XOSMetronetUNI(XOSResource):
51 provides = "tosca.nodes.EcordUserNetworkInterface"
52 xos_model = UserNetworkInterface
53 copyin_props = ['enabled','capacity','bw_used','vlanIds', 'location', 'latlng', 'name']