package com.bocloud.ims.entity.resource;

import com.bocloud.cmp.model.NetworkModel;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.bocloud.ims.entity.resource.fusionsphere.FusionSphereUpLink;
import com.bocloud.ims.entity.resource.fusionsphere.FusionSphereVlanPool;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * 交换机
 *
 * @author weiwei
 */
@Table("switcher")
@Data
public class Switcher extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id; // ID
	@Column("uuid")
	private String uuid;
	@Column("type")
	private String type;
	@Column("port_num")
	private Integer portNum;
	@Column("switcher_val")
	private String switcherVal;
	@Column("host_id")
	private Long hostId;
	@Column("vendor_id")
	private Long vendorId;
	@Column("vdc_id")
	private Long vdcId;
	@Column("mtu")
	private Integer mtu;// mtu
	@Column("allow_promiscuous")
	private Boolean allowPromiscuous;// 是否接受混杂模式
	@Column("mac_changes")
	private Boolean macChanges;// 是否接受mac地址更改
	@Column("forged_transmits")
	private Boolean forgedTransmits;// 是否接受伪传输
	@Column("traffic_enabled")
	private Boolean trafficEnabled;// 是否启用流量调整
	@Column("average_band_width")
	private Long averageBandWidth;// 平均带宽
	@Column("peak_band_width")
	private Long peakBandWidth;// 带宽峰值
	@Column("burst_size")
	private Long burstSize;// 突发大小
	@Column("policy")
	private String policy;// 负载平衡
	@Column("check_beacon")
	private Boolean checkBeacon;// 网络故障切换检测
	@Column("notify_switches")
	private Boolean notifySwitches;// 通知交换机
	@Column("rolling_order")
	private Boolean rollingOrder;// 故障恢复
	@Column("active_nics")
	private String activeNics;// 活动适配器
	@Column("standby_nics")
	private String standbyNics;// 备用适配器
	@Column("manager_name")
	private String managerName;// 管理员名称
	@Column("manager_contact")
	private String managerContact;// 管理员其他详细信息
	@Column("collector_ip_address")
	private String collectorIpAddress;// 收集器IP地址
	@Column("collector_port")
	private Integer collectorPort;// 收集器端口
	@Column("vds_ip_address")
	private String vdsIpAddress;// 分布式交换机IP地址
	@Column("active_flow_timeout")
	private Integer activeFlowTimeout;// 活动流导出超时
	@Column("idle_flow_timeout")
	private Integer idleFlowTimeout;// 限制流导出超时
	@Column("sampling_rate")
	private Integer samplingRate;// 采样率
	@Column("internal_flows_only")
	private Boolean internalFlowsOnly;// 是否仅处理内部流
	@Column("p_vlans")
	private String pVlans;// 专用VLAN
	@Column("protocol")
	private String protocol;// 发现协议类型
	@Column("operation")
	private String operation;// 发现协议操作
	@Column("dvport_names")
	private String dvportNames;// 上行链路端口数名称
	@Column("dvport_num")
	private Integer dvportNum;// 上行链路端口数
	@Column("guid")
	private String guid;// guid
	@IgnoreAll
	private String vendorName;
	@IgnoreAll
	private String vdcName;
	@IgnoreAll
	private List<PortGroup> groups;
	@IgnoreAll
	private NetworkModel network;
	@IgnoreAll
	private List<NetworkCard> networkCards;// 连接的物理适配器

	@Column("network_type")
	private String networkType;// 网卡类型
	@Column("bond_name")
	private String bondName;
	@Column("bond_mode")
	private String bondMode;
	@Column("ovsbr_name")
	private String ovsbrName; // ovs网桥名称
	@IgnoreAll
	private Map<String, List<String>> hostNetworkCards;

	//fc 纳管
	@Column("is_igmp_snooping")
	private Boolean isIgmpSnooping;//组播
	@Column("uri")
	private String uri;//访问该switch对应的uri地址
	@IgnoreAll
	private List<FusionSphereVlanPool> vlanPools;
	@IgnoreAll
	private List<FusionSphereUpLink> upLinks;
	@IgnoreAll
	private String action;
	@IgnoreAll
	private Integer portGroupNum;
	//fc 纳管

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the portNum
	 */
	public Integer getPortNum() {
		return portNum;
	}

	/**
	 * @param portNum the portNum to set
	 */
	public void setPortNum(Integer portNum) {
		this.portNum = portNum;
	}

	/**
	 * @return the switcherVal
	 */
	public String getSwitcherVal() {
		return switcherVal;
	}

	/**
	 * @param switcherVal the switcherVal to set
	 */
	public void setSwitcherVal(String switcherVal) {
		this.switcherVal = switcherVal;
	}

	/**
	 * @return the hostId
	 */
	public Long getHostId() {
		return hostId;
	}

	/**
	 * @param hostId the hostId to set
	 */
	public void setHostId(Long hostId) {
		this.hostId = hostId;
	}

	/**
	 * @return the vendorId
	 */
	public Long getVendorId() {
		return vendorId;
	}

	/**
	 * @param vendorId the vendorId to set
	 */
	public void setVendorId(Long vendorId) {
		this.vendorId = vendorId;
	}

	/**
	 * @return the vdcId
	 */
	public Long getVdcId() {
		return vdcId;
	}

	/**
	 * @param vdcId the vdcId to set
	 */
	public void setVdcId(Long vdcId) {
		this.vdcId = vdcId;
	}

	/**
	 * @return the vendorName
	 */
	public String getVendorName() {
		return vendorName;
	}

	/**
	 * @param vendorName the vendorName to set
	 */
	public void setVendorName(String vendorName) {
		this.vendorName = vendorName;
	}

	/**
	 * @return the vdcName
	 */
	public String getVdcName() {
		return vdcName;
	}

	/**
	 * @param vdcName the vdcName to set
	 */
	public void setVdcName(String vdcName) {
		this.vdcName = vdcName;
	}

	/**
	 * @return the groups
	 */
	public List<PortGroup> getGroups() {
		return groups;
	}

	/**
	 * @param groups the groups to set
	 */
	public void setGroups(List<PortGroup> groups) {
		this.groups = groups;
	}

	/**
	 * @return the network
	 */
	public NetworkModel getNetwork() {
		return network;
	}

	/**
	 * @param network the network to set
	 */
	public void setNetwork(NetworkModel network) {
		this.network = network;
	}

	/**
	 * @return the networkCards
	 */
	public List<NetworkCard> getNetworkCards() {
		return networkCards;
	}

	/**
	 * @param networkCards the networkCards to set
	 */
	public void setNetworkCards(List<NetworkCard> networkCards) {
		this.networkCards = networkCards;
	}

	/**
	 * @return the mtu
	 */
	public Integer getMtu() {
		return mtu;
	}

	/**
	 * @param mtu the mtu to set
	 */
	public void setMtu(Integer mtu) {
		this.mtu = mtu;
	}

	/**
	 * @return the allowPromiscuous
	 */
	public Boolean getAllowPromiscuous() {
		return allowPromiscuous;
	}

	/**
	 * @param allowPromiscuous the allowPromiscuous to set
	 */
	public void setAllowPromiscuous(Boolean allowPromiscuous) {
		this.allowPromiscuous = allowPromiscuous;
	}

	/**
	 * @return the macChanges
	 */
	public Boolean getMacChanges() {
		return macChanges;
	}

	/**
	 * @param macChanges the macChanges to set
	 */
	public void setMacChanges(Boolean macChanges) {
		this.macChanges = macChanges;
	}

	/**
	 * @return the forgedTransmits
	 */
	public Boolean getForgedTransmits() {
		return forgedTransmits;
	}

	/**
	 * @param forgedTransmits the forgedTransmits to set
	 */
	public void setForgedTransmits(Boolean forgedTransmits) {
		this.forgedTransmits = forgedTransmits;
	}

	/**
	 * @return the trafficEnabled
	 */
	public Boolean getTrafficEnabled() {
		return trafficEnabled;
	}

	/**
	 * @param trafficEnabled the trafficEnabled to set
	 */
	public void setTrafficEnabled(Boolean trafficEnabled) {
		this.trafficEnabled = trafficEnabled;
	}

	/**
	 * @return the averageBandWidth
	 */
	public Long getAverageBandWidth() {
		return averageBandWidth;
	}

	/**
	 * @param averageBandWidth the averageBandWidth to set
	 */
	public void setAverageBandWidth(Long averageBandWidth) {
		this.averageBandWidth = averageBandWidth;
	}

	/**
	 * @return the peakBandWidth
	 */
	public Long getPeakBandWidth() {
		return peakBandWidth;
	}

	/**
	 * @param peakBandWidth the peakBandWidth to set
	 */
	public void setPeakBandWidth(Long peakBandWidth) {
		this.peakBandWidth = peakBandWidth;
	}

	/**
	 * @return the burstSize
	 */
	public Long getBurstSize() {
		return burstSize;
	}

	/**
	 * @param burstSize the burstSize to set
	 */
	public void setBurstSize(Long burstSize) {
		this.burstSize = burstSize;
	}

	/**
	 * @return the policy
	 */
	public String getPolicy() {
		return policy;
	}

	/**
	 * @param policy the policy to set
	 */
	public void setPolicy(String policy) {
		this.policy = policy;
	}

	/**
	 * @return the checkBeacon
	 */
	public Boolean getCheckBeacon() {
		return checkBeacon;
	}

	/**
	 * @param checkBeacon the checkBeacon to set
	 */
	public void setCheckBeacon(Boolean checkBeacon) {
		this.checkBeacon = checkBeacon;
	}

	/**
	 * @return the notifySwitches
	 */
	public Boolean getNotifySwitches() {
		return notifySwitches;
	}

	/**
	 * @param notifySwitches the notifySwitches to set
	 */
	public void setNotifySwitches(Boolean notifySwitches) {
		this.notifySwitches = notifySwitches;
	}

	/**
	 * @return the rollingOrder
	 */
	public Boolean getRollingOrder() {
		return rollingOrder;
	}

	/**
	 * @param rollingOrder the rollingOrder to set
	 */
	public void setRollingOrder(Boolean rollingOrder) {
		this.rollingOrder = rollingOrder;
	}

	/**
	 * @return the activeNics
	 */
	public String getActiveNics() {
		return activeNics;
	}

	/**
	 * @param activeNics the activeNics to set
	 */
	public void setActiveNics(String activeNics) {
		this.activeNics = activeNics;
	}

	/**
	 * @return the standbyNics
	 */
	public String getStandbyNics() {
		return standbyNics;
	}

	/**
	 * @param standbyNics the standbyNics to set
	 */
	public void setStandbyNics(String standbyNics) {
		this.standbyNics = standbyNics;
	}

	/**
	 * @return the managerName
	 */
	public String getManagerName() {
		return managerName;
	}

	/**
	 * @param managerName the managerName to set
	 */
	public void setManagerName(String managerName) {
		this.managerName = managerName;
	}

	/**
	 * @return the managerContact
	 */
	public String getManagerContact() {
		return managerContact;
	}

	/**
	 * @param managerContact the managerContact to set
	 */
	public void setManagerContact(String managerContact) {
		this.managerContact = managerContact;
	}

	/**
	 * @return the collectorIpAddress
	 */
	public String getCollectorIpAddress() {
		return collectorIpAddress;
	}

	/**
	 * @param collectorIpAddress the collectorIpAddress to set
	 */
	public void setCollectorIpAddress(String collectorIpAddress) {
		this.collectorIpAddress = collectorIpAddress;
	}

	/**
	 * @return the collectorPort
	 */
	public Integer getCollectorPort() {
		return collectorPort;
	}

	/**
	 * @param collectorPort the collectorPort to set
	 */
	public void setCollectorPort(Integer collectorPort) {
		this.collectorPort = collectorPort;
	}

	/**
	 * @return the vdsIpAddress
	 */
	public String getVdsIpAddress() {
		return vdsIpAddress;
	}

	/**
	 * @param vdsIpAddress the vdsIpAddress to set
	 */
	public void setVdsIpAddress(String vdsIpAddress) {
		this.vdsIpAddress = vdsIpAddress;
	}

	/**
	 * @return the activeFlowTimeout
	 */
	public Integer getActiveFlowTimeout() {
		return activeFlowTimeout;
	}

	/**
	 * @param activeFlowTimeout the activeFlowTimeout to set
	 */
	public void setActiveFlowTimeout(Integer activeFlowTimeout) {
		this.activeFlowTimeout = activeFlowTimeout;
	}

	/**
	 * @return the idleFlowTimeout
	 */
	public Integer getIdleFlowTimeout() {
		return idleFlowTimeout;
	}

	/**
	 * @param idleFlowTimeout the idleFlowTimeout to set
	 */
	public void setIdleFlowTimeout(Integer idleFlowTimeout) {
		this.idleFlowTimeout = idleFlowTimeout;
	}

	/**
	 * @return the samplingRate
	 */
	public Integer getSamplingRate() {
		return samplingRate;
	}

	/**
	 * @param samplingRate the samplingRate to set
	 */
	public void setSamplingRate(Integer samplingRate) {
		this.samplingRate = samplingRate;
	}

	/**
	 * @return the internalFlowsOnly
	 */
	public Boolean getInternalFlowsOnly() {
		return internalFlowsOnly;
	}

	/**
	 * @param internalFlowsOnly the internalFlowsOnly to set
	 */
	public void setInternalFlowsOnly(Boolean internalFlowsOnly) {
		this.internalFlowsOnly = internalFlowsOnly;
	}

	/**
	 * @return the pVlans
	 */
	public String getPVlans() {
		return pVlans;
	}

	/**
	 * @param pVlans the pVlans to set
	 */
	public void setPVlans(String pVlans) {
		this.pVlans = pVlans;
	}

	/**
	 * @return the protocol
	 */
	public String getProtocol() {
		return protocol;
	}

	/**
	 * @param protocol the protocol to set
	 */
	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}

	/**
	 * @return the operation
	 */
	public String getOperation() {
		return operation;
	}

	/**
	 * @param operation the operation to set
	 */
	public void setOperation(String operation) {
		this.operation = operation;
	}

	/**
	 * @return the dvportNames
	 */
	public String getDvportNames() {
		return dvportNames;
	}

	/**
	 * @param dvportNames the dvportNames to set
	 */
	public void setDvportNames(String dvportNames) {
		this.dvportNames = dvportNames;
	}

	/**
	 * @return the dvportNum
	 */
	public Integer getDvportNum() {
		return dvportNum;
	}

	/**
	 * @param dvportNum the dvportNum to set
	 */
	public void setDvportNum(Integer dvportNum) {
		this.dvportNum = dvportNum;
	}

	public String getpVlans() {
		return pVlans;
	}

	public void setpVlans(String pVlans) {
		this.pVlans = pVlans;
	}

	public String getGuid() {
		return guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	public Switcher() {
		super();
	}

	public void preSave(Long creatorId, Long menderId, Long vendorId, Long vdcId, Long hostId) {
		this.setCreatorId(creatorId);
		this.setMenderId(menderId);
		this.setVendorId(vendorId);
		this.setVdcId(vdcId);
		this.setHostId(hostId);
	}

	public String getNetworkType() {
		return networkType;
	}

	public void setNetworkType(String networkType) {
		this.networkType = networkType;
	}

	public String getUuid() {
		return uuid;
	}


	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getBondName() {
		return bondName;
	}

	public void setBondName(String bondName) {
		this.bondName = bondName;
	}

	public String getBondMode() {
		return bondMode;
	}

	public void setBondMode(String bondMode) {
		this.bondMode = bondMode;
	}

	public Map<String, List<String>> getHostNetworkCards() {
		return hostNetworkCards;
	}

	public void setHostNetworkCards(Map<String, List<String>> hostNetworkCards) {
		this.hostNetworkCards = hostNetworkCards;
	}

	public String getOvsbrName() {
		return ovsbrName;
	}

	public void setOvsbrName(String ovsbrName) {
		this.ovsbrName = ovsbrName;
	}
}
