SEBA-56 Replace Hippie-OSS blacklist with whitelist
Change-Id: I30a4149b55b6788b946acbcabb60bf947162229f
diff --git a/VERSION b/VERSION
index 3eefcb9..3018fdc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.0
+1.1.0-dev0
diff --git a/samples/oss-service-instance-invalid.yaml b/samples/oss-service-instance-invalid.yaml
index d440985..2834be4 100644
--- a/samples/oss-service-instance-invalid.yaml
+++ b/samples/oss-service-instance-invalid.yaml
@@ -26,7 +26,7 @@
properties:
name: hippie-oss
must-exist: true
- blacklist: 845f10885b5c479daab9e825c1f4ced8 # NOTE: this ONU must exist in the system (check in olt-service examples to create it)
+ whitelist: ""
oss_si:
type: tosca.nodes.HippieOSSServiceInstance
diff --git a/samples/oss-service-instance-valid.yaml b/samples/oss-service-instance-valid.yaml
index 6638fbe..3ca4236 100644
--- a/samples/oss-service-instance-valid.yaml
+++ b/samples/oss-service-instance-valid.yaml
@@ -26,7 +26,7 @@
properties:
name: hippie-oss
must-exist: true
- blacklist: ""
+ whitelist: BRCM1234 # NOTE: this ONU must exist in the system (check in olt-service examples to create it)
oss_si:
type: tosca.nodes.HippieOSSServiceInstance
diff --git a/samples/oss-service.yaml b/samples/oss-service.yaml
index 8f77ee8..62ce3e8 100644
--- a/samples/oss-service.yaml
+++ b/samples/oss-service.yaml
@@ -33,7 +33,7 @@
properties:
name: hippie-oss
kind: oss
- # blacklist: BRCM1234, BRCM4321 # this is an optional list of ONUs that you don't want to validate
+ # whitelist: BRCM1234, BRCM4321 # this is an optional list of ONUs that you do want to validate
service_dependency#oss_volt:
type: tosca.nodes.ServiceDependency
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()