Esempio n. 1
0
    def test_logbook_save(self):
        # Create a generic logbook to save
        lb_id = uuidutils.generate_uuid()
        lb_name = 'lb-%s' % (lb_id)
        lb = logbook.LogBook(lb_name, lb_id)

        # Save the logbook and record its uuid and name
        b_api.logbook_save(lb)
        self.lb_names.append(lb_name)
        self.lb_ids.append(lb_id)

        # Check that the saved logbook exists in the backend
        actual = b_api.logbook_get(lb_id)

        self.assertIsNotNone(actual)
        # Check that the saved logbook has no flowdetails
        self.assertEquals(len(actual), 0)

        # Add a flowdetail to the logbook
        fd = b_api.flowdetail_get(self.fd_ids[0])
        lb.add_flow_detail(fd)

        # Save the updated logbook
        b_api.logbook_save(lb)

        # Check that the updated logbook is still in the backend
        actual = b_api.logbook_get(lb_id)

        self.assertIsNotNone(actual)
        # Check that the added flowdetail was recorded
        self.assertEquals(len(actual), 1)
Esempio n. 2
0
 def save(self):
     b_api.logbook_save(self)