[EDGEPOD-151] Modification in Fabric Switch and Switch Port Synchronizer to use fabric per site
Change-Id: I8dd412003c30315e04455fa049ceaf36d8353f91
diff --git a/xos/synchronizer/steps/sync_fabric_switch.py b/xos/synchronizer/steps/sync_fabric_switch.py
index 15031cf..16943e4 100644
--- a/xos/synchronizer/steps/sync_fabric_switch.py
+++ b/xos/synchronizer/steps/sync_fabric_switch.py
@@ -1,4 +1,3 @@
-
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +26,6 @@
log = create_logger(Config().get('logging'))
-
class SyncFabricSwitch(SyncStep):
provides = [Switch]
observes = Switch
@@ -56,11 +54,9 @@
}
}
- onos = Helpers.get_onos_fabric_service(model_accessor=self.model_accessor)
-
+ onos = Helpers.get_onos(model, self.model_accessor)
url = 'http://%s:%s/onos/v1/network/configuration/' % (onos.rest_hostname, onos.rest_port)
r = requests.post(url, json=data, auth=HTTPBasicAuth(onos.rest_username, onos.rest_password))
-
if r.status_code != 200:
log.error(r.text)
raise Exception("Failed to add device %s into ONOS: %s" % (model.name, r.text))
@@ -72,12 +68,9 @@
def delete_record(self, model):
log.info("Removing switch %s from onos-fabric" % model.name)
- onos = Helpers.get_onos_fabric_service(model_accessor=self.model_accessor)
- url = 'http://%s:%s/onos/v1/network/configuration/devices/%s' % (
- onos.rest_hostname, onos.rest_port, model.ofId)
-
+ onos = Helpers.get_onos(model, self.model_accessor)
+ url = 'http://%s:%s/onos/v1/network/configuration/devices/%s' % (onos.rest_hostname, onos.rest_port, model.ofId)
r = requests.delete(url, auth=HTTPBasicAuth(onos.rest_username, onos.rest_password))
-
if r.status_code != 204:
log.error(r.text)
raise Exception("Failed to remove switch %s from ONOS" % model.name)