Beispiel #1
0
 def _test_set_port_state(self, fmt):
     LOG.debug("_test_set_port_state - fmt:%s - START", fmt)
     content_type = "application/%s" % fmt
     port_state = "DOWN"
     new_port_state = "ACTIVE"
     network_id = self._create_network(fmt)
     port_id = self._create_port(network_id, port_state, fmt)
     update_port_req = testlib.update_port_request(self.tenant_id, network_id, port_id, new_port_state, fmt)
     update_port_res = update_port_req.get_response(self.api)
     self.assertEqual(update_port_res.status_int, 204)
     show_port_req = testlib.show_port_request(self.tenant_id, network_id, port_id, fmt)
     show_port_res = show_port_req.get_response(self.api)
     self.assertEqual(show_port_res.status_int, 200)
     port_data = self._deserialize_port_response(content_type, show_port_res)
     self.assert_port(id=port_id, state=new_port_state, port_data=port_data["port"])
     # now set it back to the original value
     update_port_req = testlib.update_port_request(self.tenant_id, network_id, port_id, port_state, fmt)
     update_port_res = update_port_req.get_response(self.api)
     self.assertEqual(update_port_res.status_int, 204)
     show_port_req = testlib.show_port_request(self.tenant_id, network_id, port_id, fmt)
     show_port_res = show_port_req.get_response(self.api)
     self.assertEqual(show_port_res.status_int, 200)
     port_data = self._deserialize_port_response(content_type, show_port_res)
     self.assert_port(id=port_id, state=port_state, port_data=port_data["port"])
     LOG.debug("_test_set_port_state - fmt:%s - END", fmt)
Beispiel #2
0
 def _test_set_port_state_stateinvalid(self, fmt):
     LOG.debug("_test_set_port_state_stateinvalid - fmt:%s - START", fmt)
     port_state = "DOWN"
     new_port_state = "A_BAD_STATE"
     network_id = self._create_network(fmt)
     port_id = self._create_port(network_id, port_state, fmt)
     update_port_req = testlib.update_port_request(self.tenant_id, network_id, port_id, new_port_state, fmt)
     update_port_res = update_port_req.get_response(self.api)
     self.assertEqual(update_port_res.status_int, self._port_state_invalid_code)
     LOG.debug("_test_set_port_state_stateinvalid - fmt:%s - END", fmt)