blob: 108de2f15213e18e1827f8bf33022aa579b4cebd [file] [log] [blame]
Scott Bakere96314e2018-01-07 08:28:46 -08001
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
16from xos.exceptions import *
17from models_decl import *
18
19class VSGServiceInstance(VSGServiceInstance_decl):
20 class Meta:
21 proxy = True
22
23 def __init__(self, *args, **kwargs):
24 super(VSGServiceInstance, self).__init__(*args, **kwargs)
25
26 def save(self, *args, **kwargs):
27 if not self.creator:
28 if not getattr(self, "caller", None):
29 # caller must be set when creating a vCPE since it creates a slice
30 raise XOSProgrammingError("VSGServiceInstance's self.caller was not set")
31 self.creator = self.caller
32 if not self.creator:
33 raise XOSProgrammingError("VSGServiceInstance's self.creator was not set")
34
35 super(VSGServiceInstance, self).save(*args, **kwargs)
36
37class VSGService(VSGService_decl):
38 class Meta:
39 proxy = True
40
41 pass