projects
/
osm
/
SO.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
[osm/SO.git]
/
common
/
python
/
rift
/
mano
/
dts
/
subscriber
/
test
/
utest_subscriber_dts.py
diff --git
a/common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py
b/common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py
index
a69a00f
..
49c622c
100644
(file)
--- a/
common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py
+++ b/
common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py
@@
-16,26
+16,27
@@
#
import asyncio
#
import asyncio
+import gi
import sys
import types
import unittest
import uuid
import sys
import types
import unittest
import uuid
-
import rift.test.dts
import rift.mano.dts as store
import rift.test.dts
import rift.mano.dts as store
-import gi
gi.require_version('RwDtsYang', '1.0')
from gi.repository import (
RwLaunchpadYang as launchpadyang,
RwDts as rwdts,
gi.require_version('RwDtsYang', '1.0')
from gi.repository import (
RwLaunchpadYang as launchpadyang,
RwDts as rwdts,
- RwVnfdYang,
+ Rw
ProjectVnfdYang as Rw
VnfdYang,
RwVnfrYang,
RwNsrYang,
RwVnfrYang,
RwNsrYang,
- RwNsdYang,
+ Rw
ProjectNsdYang as Rw
NsdYang,
VnfrYang
)
VnfrYang
)
+gi.require_version('RwKeyspec', '1.0')
+from gi.repository.RwKeyspec import quoted_key
class DescriptorPublisher(object):
class DescriptorPublisher(object):
@@
-107,11
+108,11
@@
class SubscriberStoreDtsTestCase(rift.test.dts.AbstractDTSTest):
def test_vnfd_handler(self):
yield from self.store.register()
def test_vnfd_handler(self):
yield from self.store.register()
- mock_vnfd = RwVnfdYang.YangData_
Vnfd
_VnfdCatalog_Vnfd()
+ mock_vnfd = RwVnfdYang.YangData_
RwProject_Project
_VnfdCatalog_Vnfd()
mock_vnfd.id = str(uuid.uuid1())
mock_vnfd.id = str(uuid.uuid1())
- w_xpath = "C,/
vnfd:vnfd-catalog/
vnfd:vnfd"
- xpath = "{}[
vnfd:id='{}']".format(w_xpath, mock_vnfd.id
)
+ w_xpath = "C,/
rw-project:project/project-vnfd:vnfd-catalog/project-
vnfd:vnfd"
+ xpath = "{}[
project-vnfd:id={}]".format(w_xpath, quoted_key(mock_vnfd.id)
)
yield from self.publisher.publish(w_xpath, xpath, mock_vnfd)
yield from asyncio.sleep(5, loop=self.loop)
yield from self.publisher.publish(w_xpath, xpath, mock_vnfd)
yield from asyncio.sleep(5, loop=self.loop)
@@
-128,11
+129,11
@@
class SubscriberStoreDtsTestCase(rift.test.dts.AbstractDTSTest):
def test_vnfr_handler(self):
yield from self.store.register()
def test_vnfr_handler(self):
yield from self.store.register()
- mock_vnfr = RwVnfrYang.YangData_
Vnfr
_VnfrCatalog_Vnfr()
+ mock_vnfr = RwVnfrYang.YangData_
RwProject_Project
_VnfrCatalog_Vnfr()
mock_vnfr.id = str(uuid.uuid1())
mock_vnfr.id = str(uuid.uuid1())
- w_xpath = "D,/vnfr:vnfr-catalog/vnfr:vnfr"
- xpath = "{}[vnfr:id=
'{}']".format(w_xpath, mock_vnfr.id
)
+ w_xpath = "D,/
rw-project:project/
vnfr:vnfr-catalog/vnfr:vnfr"
+ xpath = "{}[vnfr:id=
{}]".format(w_xpath, quoted_key(mock_vnfr.id)
)
yield from self.publisher.publish(w_xpath, xpath, mock_vnfr)
yield from asyncio.sleep(5, loop=self.loop)
yield from self.publisher.publish(w_xpath, xpath, mock_vnfr)
yield from asyncio.sleep(5, loop=self.loop)
@@
-151,12
+152,12
@@
class SubscriberStoreDtsTestCase(rift.test.dts.AbstractDTSTest):
def test_nsr_handler(self):
yield from self.store.register()
def test_nsr_handler(self):
yield from self.store.register()
- mock_nsr = RwNsrYang.YangData_
Nsr
_NsInstanceOpdata_Nsr()
+ mock_nsr = RwNsrYang.YangData_
RwProject_Project
_NsInstanceOpdata_Nsr()
mock_nsr.ns_instance_config_ref = str(uuid.uuid1())
mock_nsr.name_ref = "Foo"
mock_nsr.ns_instance_config_ref = str(uuid.uuid1())
mock_nsr.name_ref = "Foo"
- w_xpath = "D,/nsr:ns-instance-opdata/nsr:nsr"
- xpath = "{}[nsr:ns-instance-config-ref=
'{}']".format(w_xpath, mock_nsr.ns_instance_config_ref
)
+ w_xpath = "D,/
rw-project:project/
nsr:ns-instance-opdata/nsr:nsr"
+ xpath = "{}[nsr:ns-instance-config-ref=
{}]".format(w_xpath, quoted_key(mock_nsr.ns_instance_config_ref)
)
yield from self.publisher.publish(w_xpath, xpath, mock_nsr)
yield from asyncio.sleep(5, loop=self.loop)
yield from self.publisher.publish(w_xpath, xpath, mock_nsr)
yield from asyncio.sleep(5, loop=self.loop)
@@
-175,11
+176,11
@@
class SubscriberStoreDtsTestCase(rift.test.dts.AbstractDTSTest):
def test_nsd_handler(self):
yield from self.store.register()
def test_nsd_handler(self):
yield from self.store.register()
- mock_nsd = RwNsdYang.YangData_
Nsd
_NsdCatalog_Nsd()
+ mock_nsd = RwNsdYang.YangData_
RwProject_Project
_NsdCatalog_Nsd()
mock_nsd.id = str(uuid.uuid1())
mock_nsd.id = str(uuid.uuid1())
- w_xpath = "C,/
nsd:nsd-catalog/
nsd:nsd"
- xpath = "{}[
nsd:id='{}']".format(w_xpath, mock_nsd.id
)
+ w_xpath = "C,/
rw-project:project/project-nsd:nsd-catalog/project-
nsd:nsd"
+ xpath = "{}[
project-nsd:id={}]".format(w_xpath, quoted_key(mock_nsd.id)
)
yield from self.publisher.publish(w_xpath, xpath, mock_nsd)
yield from asyncio.sleep(2, loop=self.loop)
yield from self.publisher.publish(w_xpath, xpath, mock_nsd)
yield from asyncio.sleep(2, loop=self.loop)
@@
-206,22
+207,22
@@
class SubscriberStoreDtsTestCase(rift.test.dts.AbstractDTSTest):
# publish
yield from vnf_handler.register()
# publish
yield from vnf_handler.register()
- mock_vnfr = RwVnfrYang.YangData_
Vnfr
_VnfrCatalog_Vnfr()
+ mock_vnfr = RwVnfrYang.YangData_
RwProject_Project
_VnfrCatalog_Vnfr()
mock_vnfr.id = str(uuid.uuid1())
def mon_xpath(param_id=None):
""" Monitoring params xpath """
mock_vnfr.id = str(uuid.uuid1())
def mon_xpath(param_id=None):
""" Monitoring params xpath """
- return("D,/vnfr:vnfr-catalog" +
- "/vnfr:vnfr[vnfr:id=
'{}']".format(mock_vnfr.id
) +
+ return("D,/
rw-project:project/
vnfr:vnfr-catalog" +
+ "/vnfr:vnfr[vnfr:id=
{}]".format(quoted_key(mock_vnfr.id)
) +
"/vnfr:monitoring-param" +
"/vnfr:monitoring-param" +
- ("[vnfr:id=
'{}']".format(param_id
) if param_id else ""))
+ ("[vnfr:id=
{}]".format(quoted_key(param_id)
) if param_id else ""))
- w_xpath = "D,/vnfr:vnfr-catalog/vnfr:vnfr"
- xpath = "{}[vnfr:id=
'{}']".format(w_xpath, mock_vnfr.id
)
+ w_xpath = "D,/
rw-project:project/
vnfr:vnfr-catalog/vnfr:vnfr"
+ xpath = "{}[vnfr:id=
{}]".format(w_xpath, quoted_key(mock_vnfr.id)
)
yield from self.publisher.publish(w_xpath, xpath, mock_vnfr)
yield from self.publisher.publish(w_xpath, xpath, mock_vnfr)
- mock_param = VnfrYang.YangData_
Vnfr
_VnfrCatalog_Vnfr_MonitoringParam.from_dict({
+ mock_param = VnfrYang.YangData_
RwProject_Project
_VnfrCatalog_Vnfr_MonitoringParam.from_dict({
"id": "1"
})
mock_vnfr.monitoring_param.append(mock_param)
"id": "1"
})
mock_vnfr.monitoring_param.append(mock_param)
@@
-238,4
+239,4
@@
def main(argv=sys.argv[1:]):
)
if __name__ == '__main__':
)
if __name__ == '__main__':
- main()
\ No newline at end of file
+ main()