Add a readme.md file to document how integration tests would be run.
Fix the rest tests as well as the cold activation tests for them to
work with the latest code.
Allow the simulated_olt to create simulated_onus - needed for the
integration tests.
Change-Id: Id98e648f95e598bf9556d5114e4df52b62e2b8bf
diff --git a/tests/itests/README.md b/tests/itests/README.md
new file mode 100644
index 0000000..00d4020
--- /dev/null
+++ b/tests/itests/README.md
@@ -0,0 +1,113 @@
+## VOLTHA TESTS
+
+There are two set of test cases in Voltha:
+* **Unit Tests**
+ * These tests exercise the smallest testable parts of the code. They
+ are designed to be fully automated and can be executed by a build
+ machine (e.g. Jenkins).
+ * **Integration Tests**
+ * These tests exercise a set of modules when combined together
+
+For now, this document focuses on running the integration tests only.
+
+##### Running the Integration Tests
+
+This section provides the high level details on how to execute the Voltha
+integration tests when running inside a Vagrant box. They may need to be
+adjusted when run in a different environment.
+
+* **Build_md_test**: This tests the instructions in the voltha/BUILD.md file.
+Note that this test takes a while to run (more than 40 mins).
+```
+cd /cord/incubator/voltha
+. ./env.sh
+nosetests -s tests/itests/docutests/build_md_test.py
+```
+* **Ofagent_multicontroller_failover**: TODO
+
+* **Frameio**: This tests the packet send/receive/filter capabilities of the
+FrameIOManager. This test needs to run as root.
+```
+cd /cord/incubator/voltha
+. ./env.sh
+make run-as-root-tests
+```
+* **Cold_activation_sequence**: This test creates the simulated_olt devices and
+run through a cold activation sequence. It exercises the following
+areas:
+ * Chameleon REST interface
+ * Voltha GRPC interface
+ * Voltha data model and business logic
+ * Simulated Adapter
+
+```
+cd /cord/incubator/voltha
+. ./env.sh
+docker-compose -f compose/docker-compose-system-test.yml up -d
+nosetests -s tests/itests/voltha/test_cold_activation_sequence.py
+```
+* **Device_state_changes**: This tests uses the ponsim OLT and ONUs to exercise
+the device state changes (preprovisioning, enabled, disabled, reboot).
+It exercises the following areas:
+ * Chameleon REST interface
+ * Voltha GRPC interface
+ * Voltha data model and business logic
+ * Ponsim_olt and Ponsim_onu adapters
+ * Ponsim
+
+First start the Voltha ensemble:
+```
+cd /cord/incubator/voltha
+. ./env.sh
+docker-compose -f compose/docker-compose-system-test.yml up -d
+```
+Then start PONSIM in a separate window:
+```
+sudo -s
+. ./env.sh
+./ponsim/main.py -v -o 4
+```
+Run the test:
+```
+nosetests -s tests/itests/voltha/test_device_state_changes.py
+```
+
+* **Persistence**: This test goes through several voltha restarts along with variations
+of configurations in between to ensure data integrity is preserved.
+
+During this test, the user will be prompted to start ponsim. Use
+these commands to run ponsim with 1 OLT and 4 ONUs. THis will also
+enable alarm at a frequency of 5 seconds:
+```
+sudo -s
+. ./env.sh
+./ponsim/main.py -v -o 4 -a -f 5
+```
+
+The user will also be prompted to enable port forwarding on ponmgmt
+bridge. Use these commands:
+```
+sudo -s
+echo 8 > /sys/class/net/ponmgmt/bridge/group_fwd_mask
+```
+
+Run the test:
+```
+nosetests -s tests/itests/voltha/test_persistence.py
+```
+
+* **Voltha_rest_apis**: This test exercises the Chameleon REST interface and
+indirectly
+ the Voltha GPRC interface as well. It tests both the Local and the Global
+ interfaces.
+
+```
+cd /cord/incubator/voltha
+. ./env.sh
+docker-compose -f compose/docker-compose-system-test.yml up -d
+nosetests -s tests/itests/voltha/test_voltha_rest_apis.py
+```
+
+* Voltha_alarm_events: TODO
+
+* Voltha_alarm_filters: TODO
diff --git a/tests/itests/voltha/test_cold_activation_sequence.py b/tests/itests/voltha/test_cold_activation_sequence.py
index 5a0d7ad..9a780f5 100644
--- a/tests/itests/voltha/test_cold_activation_sequence.py
+++ b/tests/itests/voltha/test_cold_activation_sequence.py
@@ -7,10 +7,18 @@
from voltha.protos.common_pb2 import AdminState, OperStatus
from voltha.protos import openflow_13_pb2 as ofp
from tests.itests.voltha.rest_base import RestBase
+from common.utils.consulhelpers import get_endpoint_from_consul
+LOCAL_CONSUL = "localhost:8500"
class TestColdActivationSequence(RestBase):
+ # Retrieve details of the REST entry point
+ rest_endpoint = get_endpoint_from_consul(LOCAL_CONSUL, 'chameleon-rest')
+
+ # Construct the base_url
+ base_url = 'http://' + rest_endpoint
+
def wait_till(self, msg, predicate, interval=0.1, timeout=5.0):
deadline = time() + timeout
while time() < deadline:
@@ -128,8 +136,8 @@
if d['parent_id'] == olt_id
]
self.wait_till(
- 'find four ONUs linked to the olt device',
- lambda: len(find_our_onus()) >= 4,
+ 'find ONUs linked to the olt device',
+ lambda: len(find_our_onus()) >= 1,
2
)
diff --git a/tests/itests/voltha/test_voltha_rest_apis.py b/tests/itests/voltha/test_voltha_rest_apis.py
index a9c9bc1..b1f66d6 100644
--- a/tests/itests/voltha/test_voltha_rest_apis.py
+++ b/tests/itests/voltha/test_voltha_rest_apis.py
@@ -2,64 +2,182 @@
from time import time, sleep
from google.protobuf.json_format import MessageToDict
-from unittest import main
-
+from unittest import main, TestCase
+from voltha.protos.device_pb2 import Device
from tests.itests.voltha.rest_base import RestBase
from voltha.core.flow_decomposer import mk_simple_flow_mod, in_port, output
from voltha.protos import openflow_13_pb2 as ofp
+from common.utils.consulhelpers import get_endpoint_from_consul
+LOCAL_CONSUL = "localhost:8500"
class GlobalRestCalls(RestBase):
- # ~~~~~~~~~~~~~~~~~~~~~ GLOBAL TOP-LEVEL SERVICES~ ~~~~~~~~~~~~~~~~~~~~~~~~
+ def wait_till(self, msg, predicate, interval=0.1, timeout=5.0):
+ deadline = time() + timeout
+ while time() < deadline:
+ if predicate():
+ return
+ sleep(interval)
+ self.fail('Timed out while waiting for condition: {}'.format(msg))
- def test_get_root(self):
+ # Retrieve details of the REST entry point
+ rest_endpoint = get_endpoint_from_consul(LOCAL_CONSUL, 'chameleon-rest')
+
+ # Construct the base_url
+ base_url = 'http://' + rest_endpoint
+
+ def test_01_global_rest_apis(self):
+ # ~~~~~~~~~~~~~~~~~~~ GLOBAL TOP-LEVEL SERVICES~ ~~~~~~~~~~~~~~~~~~~~~~
+ self._get_root()
+ self._get_schema()
+ self._get_health()
+ # ~~~~~~~~~~~~~~~~~~~ TOP LEVEL VOLTHA OPERATIONS ~~~~~~~~~~~~~~~~~~~~~
+ self._get_voltha()
+ self._list_voltha_instances()
+ self._get_voltha_instance()
+ olt_id = self._add_olt_device()
+ self._verify_device_preprovisioned_state(olt_id)
+ self._activate_device(olt_id)
+ ldev_id = self._wait_for_logical_device(olt_id)
+ ldevices = self._list_logical_devices()
+ logical_device_id = ldevices['items'][0]['id']
+ self._get_logical_device(logical_device_id)
+ self._list_logical_device_ports(logical_device_id)
+ self._list_and_update_logical_device_flows(logical_device_id)
+ self._list_and_update_logical_device_flow_groups(logical_device_id)
+ devices = self._list_devices()
+ device_id = devices['items'][0]['id']
+ self._get_device(device_id)
+ self._list_device_ports(device_id)
+ self._list_device_flows(device_id)
+ self._list_device_flow_groups(device_id)
+ dtypes = self._list_device_types()
+ self._get_device_type(dtypes['items'][0]['id'])
+
+
+ def _get_root(self):
res = self.get('/', expected_content_type='text/html')
self.assertGreaterEqual(res.find('swagger'), 0)
- def test_get_schema(self):
+ def _get_schema(self):
res = self.get('/schema')
- self.assertEqual(set(res.keys()), {'protos', 'swagger_from'})
+ self.assertEqual(set(res.keys()), {'protos', 'yang_from','swagger_from'})
- def test_get_health(self):
+ def _get_health(self):
res = self.get('/health')
self.assertEqual(res['state'], 'HEALTHY')
# ~~~~~~~~~~~~~~~~~~~~~ TOP LEVEL VOLTHA OPERATIONS ~~~~~~~~~~~~~~~~~~~~~~~
- def test_get_voltha(self):
+ def _get_voltha(self):
res = self.get('/api/v1')
self.assertEqual(res['version'], '0.9.0')
- def test_list_voltha_instances(self):
+ def _list_voltha_instances(self):
res = self.get('/api/v1/instances')
self.assertEqual(len(res['items']), 1)
- def test_get_voltha_instance(self):
- res = self.get('/api/v1/instances/1')
+ def _get_voltha_instance(self):
+ res = self.get('/api/v1/instances')
+ voltha_id=res['items'][0]
+ res = self.get('/api/v1/instances/{}'.format(voltha_id))
self.assertEqual(res['version'], '0.9.0')
- def test_list_logical_devices(self):
+ def _add_olt_device(self):
+ device = Device(
+ type='simulated_olt',
+ mac_address='00:00:00:00:00:01'
+ )
+ device = self.post('/api/v1/devices', MessageToDict(device),
+ expected_code=200)
+ return device['id']
+
+ def _verify_device_preprovisioned_state(self, olt_id):
+ # we also check that so far what we read back is same as what we get
+ # back on create
+ device = self.get('/api/v1/devices/{}'.format(olt_id))
+ self.assertNotEqual(device['id'], '')
+ self.assertEqual(device['adapter'], 'simulated_olt')
+ self.assertEqual(device['admin_state'], 'PREPROVISIONED')
+ self.assertEqual(device['oper_status'], 'UNKNOWN')
+
+ def _activate_device(self, olt_id):
+ path = '/api/v1/devices/{}'.format(olt_id)
+ self.post(path + '/enable', expected_code=200)
+ device = self.get(path)
+ self.assertEqual(device['admin_state'], 'ENABLED')
+
+ self.wait_till(
+ 'admin state moves to ACTIVATING or ACTIVE',
+ lambda: self.get(path)['oper_status'] in ('ACTIVATING', 'ACTIVE'),
+ timeout=0.5)
+
+ # eventually, it shall move to active state and by then we shall have
+ # device details filled, connect_state set, and device ports created
+ self.wait_till(
+ 'admin state ACTIVE',
+ lambda: self.get(path)['oper_status'] == 'ACTIVE',
+ timeout=0.5)
+ device = self.get(path)
+ images = device['images']
+ image = images['image']
+ image_1 = image[0]
+ version = image_1['version']
+ self.assertNotEqual(version, '')
+ self.assertEqual(device['connect_status'], 'REACHABLE')
+
+ ports = self.get(path + '/ports')['items']
+ self.assertEqual(len(ports), 2)
+
+ def _wait_for_logical_device(self, olt_id):
+ # we shall find the logical device id from the parent_id of the olt
+ # (root) device
+ device = self.get(
+ '/api/v1/devices/{}'.format(olt_id))
+ self.assertNotEqual(device['parent_id'], '')
+ logical_device = self.get(
+ '/api/v1/logical_devices/{}'.format(device['parent_id']))
+
+ # the logical device shall be linked back to the hard device,
+ # its ports too
+ self.assertEqual(logical_device['root_device_id'], device['id'])
+
+ logical_ports = self.get(
+ '/api/v1/logical_devices/{}/ports'.format(
+ logical_device['id'])
+ )['items']
+ self.assertGreaterEqual(len(logical_ports), 1)
+ logical_port = logical_ports[0]
+ self.assertEqual(logical_port['id'], 'nni')
+ self.assertEqual(logical_port['ofp_port']['name'], 'nni')
+ self.assertEqual(logical_port['ofp_port']['port_no'], 129)
+ self.assertEqual(logical_port['device_id'], device['id'])
+ self.assertEqual(logical_port['device_port_no'], 2)
+ return logical_device['id']
+
+ def _list_logical_devices(self):
res = self.get('/api/v1/logical_devices')
self.assertGreaterEqual(len(res['items']), 1)
+ return res
- def test_get_logical_device(self):
- res = self.get('/api/v1/logical_devices/simulated1')
- self.assertEqual(res['datapath_id'], '1')
+ def _get_logical_device(self, id):
+ res = self.get('/api/v1/logical_devices/{}'.format(id))
+ self.assertIsNotNone(res['datapath_id'])
- def test_list_logical_device_ports(self):
- res = self.get('/api/v1/logical_devices/simulated1/ports')
- self.assertGreaterEqual(len(res['items']), 3)
+ def _list_logical_device_ports(self, id):
+ res = self.get('/api/v1/logical_devices/{}/ports'.format(id))
+ self.assertGreaterEqual(len(res['items']), 1)
- def test_list_and_update_logical_device_flows(self):
+ def _list_and_update_logical_device_flows(self, id):
# retrieve flow list
- res = self.get('/api/v1/logical_devices/simulated1/flows')
+ res = self.get('/api/v1/logical_devices/{}/flows'.format(id))
len_before = len(res['items'])
# add some flows
req = ofp.FlowTableUpdate(
- id='simulated1',
+ id=id,
flow_mod=mk_simple_flow_mod(
cookie=randint(1, 10000000000),
priority=len_before,
@@ -71,24 +189,24 @@
]
)
)
- res = self.post('/api/v1/logical_devices/simulated1/flows',
+ res = self.post('/api/v1/logical_devices/{}/flows'.format(id),
MessageToDict(req, preserving_proto_field_name=True),
expected_code=200)
# TODO check some stuff on res
- res = self.get('/api/v1/logical_devices/simulated1/flows')
+ res = self.get('/api/v1/logical_devices/{}/flows'.format(id))
len_after = len(res['items'])
self.assertGreater(len_after, len_before)
- def test_list_and_update_logical_device_flow_groups(self):
+ def _list_and_update_logical_device_flow_groups(self, id):
# retrieve flow list
- res = self.get('/api/v1/logical_devices/simulated1/flow_groups')
+ res = self.get('/api/v1/logical_devices/{}/flow_groups'.format(id))
len_before = len(res['items'])
# add some flows
req = ofp.FlowGroupTableUpdate(
- id='simulated1',
+ id=id,
group_mod=ofp.ofp_group_mod(
command=ofp.OFPGC_ADD,
type=ofp.OFPGT_ALL,
@@ -107,92 +225,121 @@
]
)
)
- res = self.post('/api/v1/logical_devices/simulated1/flow_groups',
+ res = self.post('/api/v1/logical_devices/{}/flow_groups'.format(id),
MessageToDict(req, preserving_proto_field_name=True),
expected_code=200)
# TODO check some stuff on res
- res = self.get('/api/v1/logical_devices/simulated1/flow_groups')
+ res = self.get('/api/v1/logical_devices/{}/flow_groups'.format(id))
len_after = len(res['items'])
self.assertGreater(len_after, len_before)
- def test_list_devices(self):
+ def _list_devices(self):
res = self.get('/api/v1/devices')
self.assertGreaterEqual(len(res['items']), 2)
+ return res
- def test_get_device(self):
- res = self.get('/api/v1/devices/simulated_olt_1')
+ def _get_device(self, id):
+ res = self.get('/api/v1/devices/{}'.format(id))
# TODO test result
- def test_list_device_ports(self):
- res = self.get('/api/v1/devices/simulated_olt_1/ports')
+ def _list_device_ports(self, id):
+ res = self.get('/api/v1/devices/{}/ports'.format(id))
self.assertGreaterEqual(len(res['items']), 2)
- def test_list_device_flows(self):
+ def _list_device_flows(self, id):
# pump some flows into the logical device
- self.test_list_and_update_logical_device_flows()
- res = self.get('/api/v1/devices/simulated_olt_1/flows')
+ res = self.get('/api/v1/devices/{}/flows'.format(id))
self.assertGreaterEqual(len(res['items']), 1)
- def test_list_device_flow_groups(self):
- res = self.get('/api/v1/devices/simulated_olt_1/flow_groups')
+ def _list_device_flow_groups(self,id):
+ res = self.get('/api/v1/devices/{}/flow_groups'.format(id))
self.assertGreaterEqual(len(res['items']), 0)
- def test_list_device_types(self):
+ def _list_device_types(self):
res = self.get('/api/v1/device_types')
self.assertGreaterEqual(len(res['items']), 2)
+ return res
- def test_get_device_type(self):
- res = self.get('/api/v1/device_types/simulated_olt')
+ def _get_device_type(self, dtype):
+ res = self.get('/api/v1/device_types/{}'.format(dtype))
+ self.assertIsNotNone(res)
# TODO test the result
- def test_list_device_groups(self):
- res = self.get('/api/v1/device_groups')
- self.assertGreaterEqual(len(res['items']), 1)
+ def _list_device_groups(self):
+ pass
+ # res = self.get('/api/v1/device_groups')
+ # self.assertGreaterEqual(len(res['items']), 1)
- def test_get_device_group(self):
- res = self.get('/api/v1/device_groups/1')
- # TODO test the result
+ def _get_device_group(self):
+ pass
+ # res = self.get('/api/v1/device_groups/1')
+ # # TODO test the result
class TestLocalRestCalls(RestBase):
- # ~~~~~~~~~~~~~~~~~~ VOLTHA INSTANCE LEVEL OPERATIONS ~~~~~~~~~~~~~~~~~~~~~
+ # Retrieve details of the REST entry point
+ rest_endpoint = get_endpoint_from_consul(LOCAL_CONSUL, 'chameleon-rest')
- def test_get_local(self):
+ # Construct the base_url
+ base_url = 'http://' + rest_endpoint
+
+ def test_02_local_rest_apis(self):
+ # ~~~~~~~~~~~~~~~~ VOLTHA INSTANCE LEVEL OPERATIONS ~~~~~~~~~~~~~~~~~~~
+ self._get_local()
+ self._get_local_health()
+ self._list_local_adapters()
+ ldevices = self._list_local_logical_devices()
+ logical_device_id = ldevices[0]['id']
+ self._get_local_logical_device(logical_device_id)
+ self._list_local_logical_device_ports(logical_device_id)
+ self._list_and_update_local_logical_device_flows(logical_device_id)
+ self._list_and_update_local_logical_device_flow_groups(logical_device_id)
+ devices = self._list_local_devices()
+ device_id = devices['items'][0]['id']
+ self._get_local_device(device_id)
+ self._list_local_device_ports(device_id)
+ self._list_local_device_flows(device_id)
+ self._list_local_device_flow_groups(device_id)
+ dtypes = self._list_local_device_types()
+ self._get_local_device_type(dtypes['items'][0]['id'])
+
+ def _get_local(self):
self.assertEqual(self.get('/api/v1/local')['version'], '0.9.0')
- def test_get_local_health(self):
+ def _get_local_health(self):
d = self.get('/api/v1/local/health')
self.assertEqual(d['state'], 'HEALTHY')
- def test_list_local_adapters(self):
+ def _list_local_adapters(self):
self.assertGreaterEqual(
len(self.get('/api/v1/local/adapters')['items']), 1)
- def test_list_local_logical_devices(self):
- self.assertGreaterEqual(
- len(self.get('/api/v1/local/logical_devices')['items']), 1)
+ def _list_local_logical_devices(self):
+ res = self.get('/api/v1/local/logical_devices')['items']
+ self.assertGreaterEqual(res, 1)
+ return res
- def test_get_local_logical_device(self):
- res = self.get('/api/v1/local/logical_devices/simulated1')
- self.assertEqual(res['datapath_id'], '1')
+ def _get_local_logical_device(self, id):
+ res = self.get('/api/v1/local/logical_devices/{}'.format(id))
+ self.assertIsNotNone(res['datapath_id'])
- def test_list_local_logical_device_ports(self):
- res = self.get('/api/v1/local/logical_devices/simulated1/ports')
- self.assertGreaterEqual(len(res['items']), 3)
+ def _list_local_logical_device_ports(self, id):
+ res = self.get('/api/v1/local/logical_devices/{}/ports'.format(id))
+ self.assertGreaterEqual(len(res['items']), 1)
- def test_list_and_update_local_logical_device_flows(self):
+ def _list_and_update_local_logical_device_flows(self, id):
# retrieve flow list
- res = self.get('/api/v1/local/logical_devices/simulated1/flows')
+ res = self.get('/api/v1/local/logical_devices/{}/flows'.format(id))
len_before = len(res['items'])
t0 = time()
# add some flows
for _ in xrange(10):
req = ofp.FlowTableUpdate(
- id='simulated1',
+ id=id,
flow_mod=mk_simple_flow_mod(
cookie=randint(1, 10000000000),
priority=randint(1, 10000), # to make it unique
@@ -204,19 +351,20 @@
]
)
)
- self.post('/api/v1/local/logical_devices/simulated1/flows',
+ self.post('/api/v1/local/logical_devices/{}/flows'.format(id),
MessageToDict(req, preserving_proto_field_name=True),
expected_code=200)
print time() - t0
- res = self.get('/api/v1/local/logical_devices/simulated1/flows')
+ res = self.get('/api/v1/local/logical_devices/{}/flows'.format(id))
len_after = len(res['items'])
self.assertGreater(len_after, len_before)
- def test_list_and_update_local_logical_device_flow_groups(self):
+ def _list_and_update_local_logical_device_flow_groups(self, id):
# retrieve flow list
- res = self.get('/api/v1/local/logical_devices/simulated1/flow_groups')
+ res = self.get('/api/v1/local/logical_devices/{'
+ '}/flow_groups'.format(id))
len_before = len(res['items'])
# add some flows
@@ -241,66 +389,84 @@
)
)
- res = self.post('/api/v1/local/logical_devices/simulated1/flow_groups',
+ res = self.post('/api/v1/local/logical_devices/{'
+ '}/flow_groups'.format(id),
MessageToDict(req, preserving_proto_field_name=True),
expected_code=200)
# TODO check some stuff on res
- res = self.get('/api/v1/local/logical_devices/simulated1/flow_groups')
+ res = self.get('/api/v1/local/logical_devices/{'
+ '}/flow_groups'.format(id))
len_after = len(res['items'])
self.assertGreater(len_after, len_before)
- def test_list_local_devices(self):
+ def _list_local_devices(self):
res = self.get('/api/v1/local/devices')
self.assertGreaterEqual(len(res['items']), 2)
+ return res
- def test_get_local_device(self):
- res = self.get('/api/v1/local/devices/simulated_olt_1')
- # TODO test result
+ def _get_local_device(self, id):
+ res = self.get('/api/v1/local/devices/{}'.format(id))
+ self.assertIsNotNone(res)
- def test_list_local_device_ports(self):
- res = self.get('/api/v1/local/devices/simulated_olt_1/ports')
+ def _list_local_device_ports(self, id):
+ res = self.get('/api/v1/local/devices/{}/ports'.format(id))
self.assertGreaterEqual(len(res['items']), 2)
- def test_list_local_device_flows(self):
- res = self.get('/api/v1/local/devices/simulated_olt_1/flows')
+ def _list_local_device_flows(self, id):
+ res = self.get('/api/v1/local/devices/{}/flows'.format(id))
self.assertGreaterEqual(len(res['items']), 0)
- def test_list_local_device_flow_groups(self):
- res = self.get('/api/v1/local/devices/simulated_olt_1/flow_groups')
+ def _list_local_device_flow_groups(self, id):
+ res = self.get('/api/v1/local/devices/{}/flow_groups'.format(id))
self.assertGreaterEqual(len(res['items']), 0)
- def test_list_local_device_types(self):
+ def _list_local_device_types(self):
res = self.get('/api/v1/local/device_types')
self.assertGreaterEqual(len(res['items']), 2)
+ return res
- def test_get_local_device_type(self):
- res = self.get('/api/v1/local/device_types/simulated_olt')
- # TODO test the result
+ def _get_local_device_type(self, type):
+ res = self.get('/api/v1/local/device_types/{}'.format(type))
+ self.assertIsNotNone(res)
- def test_list_local_device_groups(self):
- res = self.get('/api/v1/local/device_groups')
- self.assertGreaterEqual(len(res['items']), 1)
+ def _list_local_device_groups(self):
+ pass
+ # res = self.get('/api/v1/local/device_groups')
+ # self.assertGreaterEqual(len(res['items']), 1)
- def test_get_local_device_group(self):
- res = self.get('/api/v1/local/device_groups/1')
- # TODO test the result
+ def _get_local_device_group(self):
+ pass
+ # res = self.get('/api/v1/local/device_groups/1')
+ # # TODO test the result
class TestGlobalNegativeCases(RestBase):
+ # Retrieve details of the REST entry point
+ rest_endpoint = get_endpoint_from_consul(LOCAL_CONSUL, 'chameleon-rest')
+
+ # Construct the base_url
+ base_url = 'http://' + rest_endpoint
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~ NEGATIVE TEST CASES ~~~~~~~~~~~~~~~~~~~~~~~~~~
- def test_invalid_url(self):
+ def test_03_negative_behavior(self):
+ self._invalid_url()
+ self._instance_not_found()
+ self._logical_device_not_found()
+ self._device_not_found()
+
+ def _invalid_url(self):
self.get('/some_invalid_url', expected_code=404)
- def test_instance_not_found(self):
+ def _instance_not_found(self):
self.get('/api/v1/instances/nay', expected_code=404)
- def test_logical_device_not_found(self):
+ def _logical_device_not_found(self):
self.get('/api/v1/logical_devices/nay', expected_code=404)
- def test_device_not_found(self):
+ def _device_not_found(self):
self.get('/api/v1/devices/nay', expected_code=404)
# TODO add more negative cases
diff --git a/voltha/adapters/simulated_olt/simulated_olt.py b/voltha/adapters/simulated_olt/simulated_olt.py
index 0759d9c..d5f206e 100644
--- a/voltha/adapters/simulated_olt/simulated_olt.py
+++ b/voltha/adapters/simulated_olt/simulated_olt.py
@@ -483,7 +483,7 @@
device.oper_status = OperStatus.ACTIVE
self.adapter_agent.update_device(device)
- # reactor.callLater(0.1, self._simulate_detection_of_onus, device.id)
+ reactor.callLater(0.1, self._simulate_detection_of_onus, device.id)
self.start_kpi_collection(device.id)
self.start_alarm_simulation(device.id)