/// <summary>
        /// Gets the vlan details from the switch ignoring the VLANs with no IP Addresses.
        /// </summary>
        /// <param name="activityData">a<see cref="IPConfigurationActivityData"/></param>
        private static void GetVlanDetails(ref NetworkNamingServiceActivityData activityData)
        {
            activityData.VirtualLanDetails.Clear();

            try
            {
                NetworkNamingServiceActivityData activity = activityData;
                INetworkSwitch networkSwitch = SwitchFactory.Create(IPAddress.Parse(activityData.SwitchIpAddress));

                // Fetch the vlan details for primary DHCP Server, second DHCP Server and Linux Server
                List <VirtualLAN> vlans = networkSwitch.GetAvailableVirtualLans().Where
                                              (item => (null != item.IPAddress) && (!string.IsNullOrEmpty(activity.LinuxServerIPAddress) && item.IPAddress.IsInSameSubnet(IPAddress.Parse(activity.LinuxServerIPAddress)) ||
                                                                                    !string.IsNullOrEmpty(activity.SecondDhcpServerIPAddress) && item.IPAddress.IsInSameSubnet(IPAddress.Parse(activity.SecondDhcpServerIPAddress)) ||
                                                                                    !string.IsNullOrEmpty(activity.PrimaryDhcpServerIPAddress) && item.IPAddress.IsInSameSubnet(IPAddress.Parse(activity.PrimaryDhcpServerIPAddress)))).ToList();

                foreach (VirtualLAN vlan in vlans)
                {
                    activityData.VirtualLanDetails.Add(vlan.Identifier, vlan.IPAddress.ToString());
                }
            }
            catch (FormatException)
            {
                // Do nothing
            }
            catch (Exception)
            {
                // Do Nothing
            }
        }
Пример #2
0
        /// <summary>
        /// Configure the switch with the radius server details
        /// </summary>
        /// <param name="activityData"><see cref="DotOneXActivityData"/></param>
        /// <returns>True for successfull configuration, else false.</returns>
        private static bool ConfigureSwitch(DotOneXActivityData activityData)
        {
            INetworkSwitch networkSwitch = SwitchFactory.Create(IPAddress.Parse(activityData.SwitchIp));

            networkSwitch.DeConfigureAllRadiusServer();

            return(networkSwitch.ConfigureRadiusServer(IPAddress.Parse(activityData.RadiusServerIp), activityData.SharedSecret));
        }