def _validate_vlan_id(vmware_dpg): try: vlan_id = int(vmware_dpg.config.defaultPortConfig.vlan.vlanId) except (TypeError, AttributeError): raise exceptions.DPGCreationError("VLAN ID must be a number.") if vlan_id == 0: raise exceptions.DPGCreationError("VLAN ID cannot be 0.")
def _validate_type(vmware_dpg): if not isinstance(vmware_dpg, vim.DistributedVirtualPortgroup): raise exceptions.DPGCreationError( "{} is not a Distributed Portgroup".format(vmware_dpg.name))
def _validate_dvs(self, vmware_dpg): dvs_name = vmware_dpg.config.distributedVirtualSwitch.name if not self._database.is_dvs_supported(dvs_name): raise exceptions.DPGCreationError("DVS {} is not " "supported.".format(dvs_name))