This paper introduces the design and implementation of P4 virtual switches (VSWs) and P4 virtual networks (VNs). The proposed switch virtualization supports multiple VSWs embedded in a single P4 physical switch (PSW). Similar to a PSW, users use standard P4 language to program their VSWs. Given a set of VSWs and their target PSW, our hypervisor integrates all the VSW programs to generate configuration files that enable the target PSW to become a platform to realize switch virtualization. Users can define customized header types and metadata for their VSWs. In addition, our system supports live reconfiguration. Reconfiguring a VSW in a PSW will not interrupt the other VSWs in the PSW. Based on the proposed switch virtualization scheme, we present the way to share multiple VNs in a P4 physical network to provide multitenant services. A VN is composed of multiple VSWs and multiple virtual links (VL), and each VN is provisioned with guaranteed bandwidth for their VLs. Each tenant can control and manage its own VN—similar to a dedicated P4 network. In addition, each tenant can assign a priority to its traffic. The proposed network virtualization guarantees traffic isolation, preventing inter-VN interference. Results on an experimental network used for performance evaluation show that our system can successfully generate VSWs and VNs. The proposed hitless reconfiguration method can prevent service interruptions between VSWs during VSW reconfiguration. The experimental results also show that our network virtualization can accurately guarantee the provisioned bandwidths of VNs in a physical P4 network.