SEBA-497 delayering, Makefile, and tox for fabric-synchronizer
Change-Id: I916f4b632019dddceae5a6f024a0b1c64d8188d8
diff --git a/xos/synchronizer/model_policies/model_policy_compute_nodes.py b/xos/synchronizer/model_policies/model_policy_compute_nodes.py
index a253a12..14044af 100644
--- a/xos/synchronizer/model_policies/model_policy_compute_nodes.py
+++ b/xos/synchronizer/model_policies/model_policy_compute_nodes.py
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
+
import ipaddress
import random
from xossynchronizer.modelaccessor import NodeToSwitchPort, PortInterface, model_accessor
@@ -21,10 +23,9 @@
from xosconfig import Config
from multistructlog import create_logger
-from helpers import Helpers
-
log = create_logger(Config().get('logging'))
+
class ComputeNodePolicy(Policy):
model_name = "NodeToSwitchPort"
@@ -42,7 +43,7 @@
@staticmethod
def generateVlan(used_vlans):
- availabel_tags = range(16, 4093)
+ availabel_tags = list(range(16, 4093))
valid_tags = list(set(availabel_tags) - set(used_vlans))
if len(valid_tags) == 0:
raise Exception("No VLANs left")
@@ -65,7 +66,12 @@
return self.handle_update(node_to_port)
def handle_update(self, node_to_port):
- log.info("MODEL_POLICY: NodeToSwitchPort %s handle update" % node_to_port.id, node=node_to_port.node, port=node_to_port.port, switch=node_to_port.port.switch)
+ log.info(
+ "MODEL_POLICY: NodeToSwitchPort %s handle update" %
+ node_to_port.id,
+ node=node_to_port.node,
+ port=node_to_port.port,
+ switch=node_to_port.port.switch)
compute_node = node_to_port.node
@@ -92,9 +98,8 @@
)
interface.save()
-
- # TODO if the model is updated I need to remove the old interface, how?
+ # TODO if the model is updated I need to remove the old interface, how?
def handle_delete(self, node_to_port):
pass