示例#1
0
        public new EthernetPort this[string name]
        {
            get
            {
                if (!_switchPortInfos.ContainsKey(name))
                {
                    _switchPortInfos[name] = new SwitchPortInfo {
                        Mode = AccessMode.ACCESS, Vlan = Vlan.Get(1).Get()
                    };
                }

                return(base[name]);
            }
        }
示例#2
0
        public void SetPort(string port, AccessMode mode, Option <ushort> vlan)
        {
            Log.Info(Hostname, $"Setting port {port} to {mode.ToString().ToLower()} mode");
            if (mode == AccessMode.TRUNK)
            {
                if (vlan != null)
                {
                    throw new Exception("Can't set VLAN for a trunking port!");
                }
            }

            if (vlan != null)
            {
                Log.Debug(Hostname, $"Accessing VLAN {vlan.Get()} on port {port}");
            }
            else
            {
                vlan = Vlan.Get(1);
            }

            _switchPortInfos[port] = new SwitchPortInfo {
                Mode = mode, Vlan = vlan.Get()
            };
        }