Beispiel #1
0
        public PSVirtualRouter(PSVirtualHub virtualHub)
        {
            this.Name = virtualHub.Name;
            this.Id   = virtualHub.Id;
            this.ResourceGroupName = virtualHub.ResourceGroupName;
            this.Location          = virtualHub.Location;
            this.ResourceGuid      = virtualHub.ResourceGuid;
            this.Type = virtualHub.Type;
            var ipconfig = virtualHub.IpConfigurations.FirstOrDefault <PSHubIpConfiguration>();

            this.HostedSubnet      = ipconfig.Subnet.Id;
            this.VirtualRouterAsn  = virtualHub.VirtualRouterAsn;
            this.VirtualRouterIps  = virtualHub.VirtualRouterIps;
            this.ProvisioningState = virtualHub.ProvisioningState;
            this.Peerings          = new List <PSVirtualRouterPeer>();
            foreach (var connection in virtualHub.BgpConnections)
            {
                var peering = new PSVirtualRouterPeer()
                {
                    Name              = connection.Name,
                    PeerIp            = connection.PeerIp,
                    PeerAsn           = connection.PeerAsn,
                    ProvisioningState = connection.ProvisioningState
                };
                this.Peerings.Add(peering);
            }
            this.AllowBranchToBranchTraffic = virtualHub.AllowBranchToBranchTraffic;
        }
Beispiel #2
0
        public void AddIpConfigurtaionToPSVirtualHub(CNM.PSVirtualHub virtualHubModel,
                                                     string resourceGroupName,
                                                     string routerName,
                                                     string ipConfigName)
        {
            var ipConfigModel = this.NetworkClient.NetworkManagementClient.VirtualHubIpConfiguration.Get(resourceGroupName, routerName, ipConfigName);
            var ipconfig      = NetworkResourceManagerProfile.Mapper.Map <CNM.PSHubIpConfiguration>(ipConfigModel);

            virtualHubModel.IpConfigurations = new List <CNM.PSHubIpConfiguration>();
            virtualHubModel.IpConfigurations.Add(ipconfig);
        }
Beispiel #3
0
        public void AddBgpConnectionsToPSVirtualHub(CNM.PSVirtualHub virtualHubModel,
                                                    string resourceGroupName,
                                                    string routerName)
        {
            var bgpConnections    = this.NetworkClient.NetworkManagementClient.VirtualHubBgpConnections.List(resourceGroupName, routerName);
            var bgpConnectionList = ListNextLink <BgpConnection> .GetAllResourcesByPollingNextLink(bgpConnections, this.NetworkClient.NetworkManagementClient.VirtualHubBgpConnections.ListNext);

            foreach (var connection in bgpConnectionList)
            {
                virtualHubModel.BgpConnections.Add(NetworkResourceManagerProfile.Mapper.Map <CNM.PSBgpConnection>(connection));
            }
        }
Beispiel #4
0
        public void AddIpConfigurtaionToPSVirtualHub(CNM.PSVirtualHub virtualHubModel,
                                                     string resourceGroupName,
                                                     string routerName)
        {
            var ipConfigModels = this.NetworkClient.NetworkManagementClient.VirtualHubIpConfiguration.List(resourceGroupName, routerName);
            var ipConfigList   = ListNextLink <HubIpConfiguration> .GetAllResourcesByPollingNextLink(ipConfigModels, this.NetworkClient.NetworkManagementClient.VirtualHubIpConfiguration.ListNext);

            HubIpConfiguration ipConfigModel = null;

            if (ipConfigList.Count > 0)
            {
                ipConfigModel = ipConfigList[0];
            }
            var ipconfig = NetworkResourceManagerProfile.Mapper.Map <CNM.PSHubIpConfiguration>(ipConfigModel);

            virtualHubModel.IpConfigurations = new List <CNM.PSHubIpConfiguration>();
            virtualHubModel.IpConfigurations.Add(ipconfig);
        }