In 5G and beyond, the end-user broadcasts data into the radio domain; therefore, protecting the physical layer security (PLS) is a more challenging issue. Here, Sparse Code Multiple Access (SCMA) handles PLS naturally. Because multiple physical resources are encoded in different codes, these codes cannot be easily decoded without sharing a mother codebook and mapping matrix. However, there are a few studies about security implementation in the physical layer against the challenges of the three subdomains of end users, base stations, and the core network. Moreover, there are two new research questions for resource allocation in SCMA: How do codebooks affect the Bit Error Rate (BER) performance of end-users? In the presence or absence of a jammer or interference, how should codebooks be assigned to users? We believe that it can only be overcome by using some new paradigms together: Software-defined radio (SDR), Software-defined networking (SDN), and network function virtualization (NFV). We consider the PLS implementation on SCMA-based 5G by investigating codebook assignment in the presence of noise/jammer with a novel Quality of Service (QoS) parameter (ϕ) , which is the ratio of the received power by the user to overloading (λ) . In the SDN/NFV controller, the QoS metric-based codebook assignment algorithm prioritizes users into newly defined PEACE, NORMAL, and WAR states. In the OpenFlow table of SDR, grant-free access can be easily implemented. As a result, the BERs for different overloading are the same for the same ratio of energy rate per bit and spectral noise density. The BER is lower when the mother codebook is 150% than when the codebook is 200%. An existing codebook of one eMBB can be utilized to serve one URLLC user and two MTC users with an acceptable BER.