Removing dependencies on the vOLT service
Change-Id: If4dd40cf51341c20901287bce597a1bb563111b3
diff --git a/xos/synchronizer/model_policies/model_policy_rcordsubscriber.py b/xos/synchronizer/model_policies/model_policy_rcordsubscriber.py
index 570aa7d..d74fda0 100644
--- a/xos/synchronizer/model_policies/model_policy_rcordsubscriber.py
+++ b/xos/synchronizer/model_policies/model_policy_rcordsubscriber.py
@@ -13,7 +13,7 @@
# limitations under the License.
-from synchronizers.new_base.modelaccessor import VOLTServiceInstance, ServiceInstanceLink
+from synchronizers.new_base.modelaccessor import ServiceInstanceLink, model_accessor
from synchronizers.new_base.policy import Policy
class RCORDSubscriberPolicy(Policy):
@@ -39,22 +39,15 @@
for link in links:
ps = link.provider_service.leaf_model
+ si_class = link.provider_service.get_service_instance_class_name()
+ self.logger.info("MODEL_POLICY: RCORDSubscriberRoot %s creating %s" % (si, si_class))
- # FIXME we should use get_service_instance_class here to support the general case.
- # we don't know what the next service in the chain will be
-
- if ps.model_name is "VOLTService":
- volt = VOLTServiceInstance(name="volt-for-subscriber-%s" % si.id)
- volt.save()
-
- si_link = ServiceInstanceLink(
- provider_service_instance=volt,
- subscriber_service_instance=si
- )
- si_link.save()
-
- print links
-
+ eastbound_si_class = model_accessor.get_model_class(si_class)
+ eastbound_si = eastbound_si_class()
+ eastbound_si.owner_id = link.provider_service_id
+ eastbound_si.save()
+ link = ServiceInstanceLink(provider_service_instance=eastbound_si, subscriber_service_instance=si)
+ link.save()
def handle_delete(self, si):
pass
diff --git a/xos/synchronizer/model_policies/test_model_policy_rcordsubscriber.py b/xos/synchronizer/model_policies/test_model_policy_rcordsubscriber.py
index e95846f..c880e2f 100644
--- a/xos/synchronizer/model_policies/test_model_policy_rcordsubscriber.py
+++ b/xos/synchronizer/model_policies/test_model_policy_rcordsubscriber.py
@@ -27,7 +27,6 @@
# NOTE this have to start for xos_services
RCORD_XPROTO = "../profiles/rcord/xos/synchronizer/models/rcord.xproto"
-OLT_XPROTO = "olt-service/xos/synchronizer/models/volt.xproto"
Config.clear()
Config.init(config_file, 'synchronizer-config-schema.yaml')
@@ -76,7 +75,7 @@
self.original_sys_path = sys.path
# Generate a fake model accessor (emulate the client library)
- build_mock_modelaccessor(xos_dir, services_dir, [RCORD_XPROTO, OLT_XPROTO])
+ build_mock_modelaccessor(xos_dir, services_dir, [RCORD_XPROTO])
import synchronizers.new_base.modelaccessor
from synchronizers.new_base.modelaccessor import model_accessor