Contingency Constrained Optimal Power Flow (CCOPF) differs from traditional Optimal Power Flow (OPF) because its generation dispatch is planned to work with state variables between constraint limits, considering a specific contingency. When it is not desired to have changes in the power dispatch after the contingency occurs, the CCOPF is studied with a preventive perspective, whereas when the contingency occurs and the power dispatch needs to change to operate the system between limits in the post-contingency state, the problem is studied with a corrective perspective. As current power system software tools mainly focus on the traditional OPF problem, having the means to solve CCOPF will benefit power systems planning and operation. This paper presents a Quadratically Constrained Quadratic Programming (QCQP) formulation built within the matpower environment as a solution strategy to the preventive CCOPF. Moreover, an extended OPF model that forces the network to meet all constraints under contingency is proposed as a strategy to find the power dispatch solution for the corrective CCOPF. Validation is made on the IEEE 14-bus test system including photovoltaic generation in one simulation case. It was found that in the QCQP formulation, the power dispatch calculated barely differs in both pre- and post-contingency scenarios while in the OPF extended power network, node voltage values in both pre- and post-contingency scenarios are equal in spite of having different power dispatch for each scenario. This suggests that both the QCQP and the extended OPF formulations proposed, could be implemented in power system software tools in order to solve CCOPF problems from a preventive or corrective perspective.