CORD-1008 update onos synchronizer to use new_base
Change-Id: I6ed2ad3ce67725bb132e81538a54c608beb868ef
diff --git a/xos/synchronizer/steps/sync_onosapp.py b/xos/synchronizer/steps/sync_onosapp.py
index d16b482..cc5d25e 100644
--- a/xos/synchronizer/steps/sync_onosapp.py
+++ b/xos/synchronizer/steps/sync_onosapp.py
@@ -7,20 +7,12 @@
import re
import json
from collections import OrderedDict
-from django.db.models import F, Q
from xos.config import Config
-from synchronizers.base.ansible_helper import run_template
-from synchronizers.base.syncstep import SyncStep
-from synchronizers.base.ansible_helper import run_template_ssh
-from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
-from core.models import Service, Slice, Controller, ControllerSlice, ControllerUser, Node, TenantAttribute, Tag
-from services.onos.models import ONOSService, ONOSApp
+from synchronizers.new_base.ansible_helper import run_template
+from synchronizers.new_base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.new_base.modelaccessor import *
from xos.logger import Logger, logging
-# hpclibrary will be in steps/..
-parentdir = os.path.join(os.path.dirname(__file__),"..")
-sys.path.insert(0,parentdir)
-
logger = Logger(level=logging.INFO)
@@ -29,19 +21,10 @@
observes=ONOSApp
requested_interval=0
template_name = "sync_onosapp.yaml"
- #service_key_name = "/opt/xos/synchronizers/onos/onos_key"
def __init__(self, *args, **kwargs):
super(SyncONOSApp, self).__init__(*args, **kwargs)
- def fetch_pending(self, deleted):
- if (not deleted):
- objs = ONOSApp.get_tenant_objects().filter(Q(enacted__lt=F('updated')) | Q(enacted=None),Q(lazy_blocked=False))
- else:
- objs = ONOSApp.get_deleted_tenant_objects()
-
- return objs
-
def get_instance(self, o):
# We assume the ONOS service owns a slice, so pick one of the instances
# inside that slice to sync to.
@@ -62,7 +45,7 @@
if not o.provider_service:
return None
- onoses = ONOSService.get_service_objects().filter(id=o.provider_service.id)
+ onoses = ONOSService.objects.filter(id=o.provider_service.id)
if not onoses:
return None
diff --git a/xos/synchronizer/steps/sync_onosservice.py b/xos/synchronizer/steps/sync_onosservice.py
index 6332fc9..e038949 100644
--- a/xos/synchronizer/steps/sync_onosservice.py
+++ b/xos/synchronizer/steps/sync_onosservice.py
@@ -4,19 +4,11 @@
import sys
import base64
import time
-from django.db.models import F, Q
from xos.config import Config
-from synchronizers.base.syncstep import SyncStep
-from synchronizers.base.ansible_helper import run_template_ssh
-from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
-from core.models import Service, Slice
-from services.onos.models import ONOSService, ONOSApp
+from synchronizers.new_base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.new_base.modelaccessor import *
from xos.logger import Logger, logging
-# hpclibrary will be in steps/..
-parentdir = os.path.join(os.path.dirname(__file__),"..")
-sys.path.insert(0,parentdir)
-
logger = Logger(level=logging.INFO)
class SyncONOSService(SyncInstanceUsingAnsible):
@@ -24,19 +16,10 @@
observes=ONOSService
requested_interval=0
template_name = "sync_onosservice.yaml"
- #service_key_name = "/opt/xos/synchronizers/onos/onos_key"
def __init__(self, *args, **kwargs):
super(SyncONOSService, self).__init__(*args, **kwargs)
- def fetch_pending(self, deleted):
- if (not deleted):
- objs = ONOSService.get_service_objects().filter(Q(enacted__lt=F('updated')) | Q(enacted=None),Q(lazy_blocked=False))
- else:
- objs = ONOSService.get_deleted_service_objects()
-
- return objs
-
def get_instance(self, o):
# We assume the ONOS service owns a slice, so pick one of the instances
# inside that slice to sync to.