SEBA-56 Replace Hippie-OSS blacklist with whitelist
Change-Id: I30a4149b55b6788b946acbcabb60bf947162229f
diff --git a/xos/synchronizer/models/hippie-oss.xproto b/xos/synchronizer/models/hippie-oss.xproto
index b111e08..4cf5c37 100644
--- a/xos/synchronizer/models/hippie-oss.xproto
+++ b/xos/synchronizer/models/hippie-oss.xproto
@@ -5,7 +5,7 @@
option verbose_name = "HippieOSS Service";
option kind = "OSS";
- optional string blacklist = 1 [help_text = "A comma separated list of ONUs that are deemed not to be valid ONUs", null = True, db_index = False, blank = False];
+ optional string whitelist = 1 [help_text = "A comma separated list of ONUs that are deemed to be valid ONUs", null = True, db_index = False, blank = False];
}
message HippieOSSServiceInstance (ServiceInstance){
diff --git a/xos/synchronizer/steps/sync_hippie_oss_service_instance.py b/xos/synchronizer/steps/sync_hippie_oss_service_instance.py
index 94b73b7..bc64f3b 100644
--- a/xos/synchronizer/steps/sync_hippie_oss_service_instance.py
+++ b/xos/synchronizer/steps/sync_hippie_oss_service_instance.py
@@ -28,11 +28,11 @@
def validate_in_external_oss(self, si):
# This is where you may want to call your OSS Database to verify if this ONU can be activated
- # for demonstration the HippieOSSService has a blacklist and if the serial_number
- # you provided is in that blacklist, it won't be validated
+ # for demonstration the HippieOSSService has a whitelist and if the serial_number
+ # you provided is not in that blacklist, it won't be validated
oss_service = si.owner.leaf_model
- if si.serial_number in [x.strip() for x in oss_service.blacklist.split(',')]:
+ if si.serial_number not in [x.strip() for x in oss_service.whitelist.split(',')]:
return False
return True
diff --git a/xos/synchronizer/steps/test_sync_hippie_oss_service_instance.py b/xos/synchronizer/steps/test_sync_hippie_oss_service_instance.py
index 508677c..6d0c6ff 100644
--- a/xos/synchronizer/steps/test_sync_hippie_oss_service_instance.py
+++ b/xos/synchronizer/steps/test_sync_hippie_oss_service_instance.py
@@ -78,7 +78,7 @@
self.oss = Mock()
self.oss.name = "oss"
- self.oss.blacklist = ""
+ self.oss.whitelist = "BRCM5678, BRCM1234"
# create a mock VRouterStaticRoute instance
self.o = Mock()
@@ -101,10 +101,13 @@
self.o.save.assert_called()
def test_sync_rejected(self):
- self.oss.blacklist = "BRCM5678, BRCM1234"
+ self.oss.whitelist = ""
self.sync_step().sync_record(self.o)
self.assertEqual(self.o.valid, "invalid")
self.assertTrue(self.o.no_sync)
- self.o.save.assert_called()
\ No newline at end of file
+ self.o.save.assert_called()
+
+if __name__ == '__main__':
+ unittest.main()