public Port(string localDeviceIdentifier, PortStatus status, int portBandwidthGbps, int portPoolId) { if (portBandwidthGbps <= 0) { throw new SigmaDomainException("The port bandwidth must be greater than 0."); } this._name = Guid.NewGuid().ToString("N"); if (string.IsNullOrEmpty(localDeviceIdentifier)) { throw new ArgumentNullException(nameof(localDeviceIdentifier)); } this._localDeviceIdentifier = localDeviceIdentifier; this._status = status ?? throw new ArgumentNullException(nameof(status)); this._portBandwidthGbps = portBandwidthGbps; this._portPoolId = portPoolId; }
/// <summary> /// Release the port. /// </summary> public void Release() { _attachmentId = null; _tenantId = null; _status = PortStatus.Free; }
/// <summary> /// Assign a port. The port may also be optionally assigned to a tenant. /// </summary> /// <param name="tenantId">Tenant identifier.</param> public void Assign(int attachmentId, int?tenantId = null) { _attachmentId = attachmentId; _tenantId = tenantId; _status = PortStatus.Assigned; }