CORD-2618 remove legacy olt onboarding recipe
Change-Id: I146225d9726c25c67c5c5de3b56049f2be7a10d0
diff --git a/xos/tosca/resources/CORDSubscriber.py b/xos/tosca/resources/CORDSubscriber.py
deleted file mode 100644
index 69f6652..0000000
--- a/xos/tosca/resources/CORDSubscriber.py
+++ /dev/null
@@ -1,32 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-#from core.models import User, TenantRootPrivilege, TenantRootRole
-from services.rcord.models import CordSubscriberRoot
-from xosresource import XOSResource
-
-class XOSCORDSubscriber(XOSResource):
- provides = "tosca.nodes.CORDSubscriber"
- xos_model = CordSubscriberRoot
- copyin_props = ["service_specific_id", "firewall_enable", "url_filter_enable", "cdn_enable", "url_filter_level"]
-
-# def postprocess(self, obj):
-# rolemap = ( ("tosca.relationships.AdminPrivilege", "admin"), ("tosca.relationships.AccessPrivilege", "access"), )
-# self.postprocess_privileges(TenantRootRole, TenantRootPrivilege, rolemap, obj, "tenant_root")
-
- def can_delete(self, obj):
- return super(XOSCORDSubscriber, self).can_delete(obj)
-
diff --git a/xos/tosca/resources/CORDUser.py b/xos/tosca/resources/CORDUser.py
deleted file mode 100644
index 2a061bb..0000000
--- a/xos/tosca/resources/CORDUser.py
+++ /dev/null
@@ -1,71 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from core.models import User
-from services.rcord.models import CordSubscriberRoot
-
-from xosresource import XOSResource
-
-class XOSCORDUser(XOSResource):
- provides = "tosca.nodes.CORDUser"
-
- def get_model_class_name(self):
- return "CORDUser"
-
- def get_subscriber_root(self, throw_exception=True):
- sub_name = self.get_requirement("tosca.relationships.SubscriberDevice", throw_exception=throw_exception)
- sub = self.get_xos_object(CordSubscriberRoot, name=sub_name, throw_exception=throw_exception)
- return sub
-
- def get_existing_objs(self):
- result = []
- sub = self.get_subscriber_root(throw_exception=False)
- if not sub:
- return []
- for user in sub.devices:
- if user["name"] == self.obj_name:
- result.append(user)
- return result
-
- def get_xos_args(self):
- args = {"name": self.obj_name,
- "level": self.get_property("level"),
- "mac": self.get_property("mac")}
- return args
-
-
- def create(self):
- xos_args = self.get_xos_args()
- sub = self.get_subscriber_root()
-
- sub.create_device(**xos_args)
- sub.save()
-
- self.info("Created CORDUser %s for Subscriber %s" % (self.obj_name, sub.name))
-
- def update(self, obj):
- pass
-
- def delete(self, obj):
- if (self.can_delete(obj)):
- self.info("destroying CORDUser %s" % obj["name"])
- sub = self.get_subscriber_root()
- sub.delete_user(obj["id"])
- sub.save()
-
- def can_delete(self, obj):
- return True
-
diff --git a/xos/tosca/resources/VOLTTenant.py b/xos/tosca/resources/VOLTTenant.py
deleted file mode 100644
index 856d990..0000000
--- a/xos/tosca/resources/VOLTTenant.py
+++ /dev/null
@@ -1,61 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from core.models import User, ServiceInstanceLink
-from services.volt.models import VOLTTenant, VOLTService, VOLT_KIND
-from services.rcord.models import CordSubscriberRoot
-
-from xosresource import XOSResource
-
-class XOSVOLTTenant(XOSResource):
- provides = "tosca.nodes.VOLTTenant"
- xos_model = VOLTTenant
- copyin_props = ["service_specific_id", "s_tag", "c_tag"]
- name_field = None
-
- def get_xos_args(self, throw_exception=True):
- args = super(XOSVOLTTenant, self).get_xos_args()
-
- provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
- if provider_name:
- args["owner"] = self.get_xos_object(VOLTService, throw_exception=throw_exception, name=provider_name)
-
- return args
-
- def get_existing_objs(self):
- args = self.get_xos_args(throw_exception=False)
- provider_service = args.get("owner", None)
- service_specific_id = args.get("service_specific_id", None)
- if (provider_service) and (service_specific_id):
- existing_obj = self.get_xos_object(VOLTTenant, owner=provider_service, service_specific_id=service_specific_id, throw_exception=False)
- if existing_obj:
- return [ existing_obj ]
- return []
-
- def postprocess(self, obj):
- subscriber_name = self.get_requirement("tosca.relationships.BelongsToSubscriber")
- if subscriber_name:
- subscriber = self.get_xos_object(CordSubscriberRoot, throw_exception=True, name=subscriber_name)
-
- links = ServiceInstanceLink.objects.filter(provider_service_instance = obj,
- subscriber_service_instance = subscriber)
- if not links:
- link = ServiceInstanceLink(provider_service_instance = obj, subscriber_service_instance = subscriber)
- link.save()
-
- def can_delete(self, obj):
- return super(XOSVOLTTenant, self).can_delete(obj)
-
diff --git a/xos/tosca/resources/accessagent.py b/xos/tosca/resources/accessagent.py
deleted file mode 100644
index fedf959..0000000
--- a/xos/tosca/resources/accessagent.py
+++ /dev/null
@@ -1,65 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from services.volt.models import AccessAgent, VOLTDevice, VOLTService, AgentPortMapping
-from xosresource import XOSResource
-
-class XOSAccessAgent(XOSResource):
- provides = "tosca.nodes.AccessAgent"
- xos_model = AccessAgent
- copyin_props = ["mac"]
-
- def get_xos_args(self, throw_exception=True):
- args = super(XOSAccessAgent, self).get_xos_args()
-
- volt_service_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
- if volt_service_name:
- args["volt_service"] = self.get_xos_object(VOLTService, throw_exception=throw_exception, name=volt_service_name)
-
- return args
-
- def postprocess(self, obj):
- # For convenient, allow the port mappings to be specified by a Tosca
- # string with commas between lines.
- # <port> <mac>,
- # <port> <mac>,
- # ...
- # <port> <mac>
-
- port_mappings_str = self.get_property("port_mappings")
- port_mappings = []
- if port_mappings_str:
- lines = [x.strip() for x in port_mappings_str.split(",")]
- for line in lines:
- if not (" " in line):
- raise "Malformed port mapping `%s`", line
- (port, mac) = line.split(" ")
- port=port.strip()
- mac=mac.strip()
- port_mappings.append( (port, mac) )
-
- for apm in list(AgentPortMapping.objects.filter(access_agent=obj)):
- if (apm.port, apm.mac) not in port_mappings:
- print "Deleting AgentPortMapping '%s'" % apm
- apm.delete()
-
- for port_mapping in port_mappings:
- existing_objs = AgentPortMapping.objects.filter(access_agent=obj, port=port_mapping[0], mac=port_mapping[1])
- if not existing_objs:
- apm = AgentPortMapping(access_agent=obj, port=port_mapping[0], mac=port_mapping[1])
- apm.save()
- print "Created AgentPortMapping '%s'" % apm
-
diff --git a/xos/tosca/resources/accessdevice.py b/xos/tosca/resources/accessdevice.py
deleted file mode 100644
index a9fd999..0000000
--- a/xos/tosca/resources/accessdevice.py
+++ /dev/null
@@ -1,49 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from services.volt.models import AccessDevice, VOLTDevice
-from xosresource import XOSResource
-
-class XOSAccessDevice(XOSResource):
- provides = "tosca.nodes.AccessDevice"
- xos_model = AccessDevice
- copyin_props = ["uplink", "vlan"]
- name_field = None
-
- def get_xos_args(self, throw_exception=True):
- args = super(XOSAccessDevice, self).get_xos_args()
-
- volt_device_name = self.get_requirement("tosca.relationships.MemberOfDevice", throw_exception=throw_exception)
- if volt_device_name:
- args["volt_device"] = self.get_xos_object(VOLTDevice, throw_exception=throw_exception, name=volt_device_name)
-
- return args
-
- # AccessDevice has no name field, so we rely on matching the keys. We assume
- # the for a given VOLTDevice, there is only one AccessDevice per (uplink, vlan)
- # pair.
-
- def get_existing_objs(self):
- args = self.get_xos_args(throw_exception=False)
- volt_device = args.get("volt_device", None)
- uplink = args.get("uplink", None)
- vlan = args.get("vlan", None)
- if (volt_device is not None) and (uplink is not None) and (vlan is not None):
- existing_obj = self.get_xos_object(AccessDevice, volt_device=volt_device, uplink=uplink, vlan=vlan, throw_exception=False)
- if existing_obj:
- return [ existing_obj ]
- return []
-
diff --git a/xos/tosca/resources/voltdevice.py b/xos/tosca/resources/voltdevice.py
deleted file mode 100644
index ef3d05e..0000000
--- a/xos/tosca/resources/voltdevice.py
+++ /dev/null
@@ -1,61 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from services.volt.models import VOLTDevice, VOLTService, AccessDevice, AccessAgent
-from xosresource import XOSResource
-
-class XOSVOLTDevice(XOSResource):
- provides = "tosca.nodes.VOLTDevice"
- xos_model = VOLTDevice
- copyin_props = ["openflow_id", "driver"]
-
- def get_xos_args(self, throw_exception=True):
- args = super(XOSVOLTDevice, self).get_xos_args()
-
- volt_service_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
- if volt_service_name:
- args["volt_service"] = self.get_xos_object(VOLTService, throw_exception=throw_exception, name=volt_service_name)
-
- agent_name = self.get_requirement("tosca.relationships.UsesAgent", throw_exception=throw_exception)
- if agent_name:
- args["access_agent"] = self.get_xos_object(AccessAgent, throw_exception=throw_exception, name=agent_name)
-
- return args
-
- def postprocess(self, obj):
- access_devices_str = self.get_property("access_devices")
- access_devices = []
- if access_devices_str:
- lines = [x.strip() for x in access_devices_str.split(",")]
- for line in lines:
- if not (" " in line):
- raise "Malformed access device `%s`", line
- (uplink, vlan) = line.split(" ")
- uplink=int(uplink.strip())
- vlan=int(vlan.strip())
- access_devices.append( (uplink, vlan) )
-
- for ad in list(AccessDevice.objects.filter(volt_device=obj)):
- if (ad.uplink, ad.vlan) not in access_devices:
- print "Deleting AccessDevice '%s'" % ad
- ad.delete()
-
- for access_device in access_devices:
- existing_objs = AccessDevice.objects.filter(volt_device=obj, uplink=access_device[0], vlan=access_device[1])
- if not existing_objs:
- ad = AccessDevice(volt_device=obj, uplink=access_device[0], vlan=access_device[1])
- ad.save()
- print "Created AccessDevice '%s'" % ad
diff --git a/xos/tosca/resources/voltservice.py b/xos/tosca/resources/voltservice.py
deleted file mode 100644
index cc28c35..0000000
--- a/xos/tosca/resources/voltservice.py
+++ /dev/null
@@ -1,23 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from services.volt.models import VOLTService
-from service import XOSService
-
-class XOSVOLTService(XOSService):
- provides = "tosca.nodes.VOLTService"
- xos_model = VOLTService
- copyin_props = ["view_url", "icon_url", "kind", "enabled", "published", "public_key", "private_key_fn", "versionNumber"]
diff --git a/xos/volt-onboard.yaml b/xos/volt-onboard.yaml
deleted file mode 100644
index 0450371..0000000
--- a/xos/volt-onboard.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Onboard the exampleservice
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- servicecontroller#volt:
- type: tosca.nodes.ServiceController
- properties:
- base_url: file:///opt/xos_services/olt-service/xos/
- # The following will concatenate with base_url automatically, if
- # base_url is non-null.
- tosca_resource: tosca/resources/voltdevice.py, tosca/resources/voltservice.py, tosca/resources/CORDSubscriber.py, tosca/resources/CORDUser.py, tosca/resources/VOLTTenant.py, tosca/resources/accessagent.py, tosca/resources/accessdevice.py
- private_key: file:///opt/xos/key_import/volt_rsa
- public_key: file:///opt/xos/key_import/volt_rsa.pub
-