示例#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)
示例#2
0
 def _test_show_port_portnotfound(self, fmt):
     LOG.debug("_test_show_port_portnotfound - fmt:%s - START", fmt)
     network_id = self._create_network(fmt)
     show_port_req = testlib.show_port_request(self.tenant_id, network_id, "A_BAD_ID", fmt)
     show_port_res = show_port_req.get_response(self.api)
     self.assertEqual(show_port_res.status_int, self._port_not_found_code)
     LOG.debug("_test_show_port_portnotfound - fmt:%s - END", fmt)
示例#3
0
 def _test_create_port_noreqbody(self, fmt):
     LOG.debug("_test_create_port_noreqbody - fmt:%s - START", fmt)
     content_type = "application/%s" % fmt
     network_id = self._create_network(fmt)
     port_id = self._create_port(network_id, None, fmt, custom_req_body="")
     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._port_deserializers[content_type].deserialize(show_port_res.body)["body"]
     self.assertEqual(port_id, port_data["port"]["id"])
     LOG.debug("_test_create_port_noreqbody - fmt:%s - END", fmt)