Esempio n. 1
0
        public async Task <IActionResult> Edit(uint id, [Bind("Id,PoolName,Framedipaddress,Nasipaddress,Calledstationid,Callingstationid,ExpiryTime,Username,PoolKey,Port")] Radippool radippool)
        {
            if (id != radippool.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(radippool);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RadippoolExists(radippool.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(radippool));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,PoolName,Framedipaddress,Nasipaddress,Calledstationid,Callingstationid,ExpiryTime,Username,PoolKey,Port")] Radippool radippool)
        {
            if (ModelState.IsValid)
            {
                _context.Add(radippool);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(radippool));
        }
Esempio n. 3
0
        private void CreateRadippool(IPAddress ip, SimGroup simGroup)
        {
            var radippool = new Radippool()
            {
                Framedipaddress  = ip.ToString(),
                Nasipaddress     = "",
                Calledstationid  = "",
                Callingstationid = "",
                Username         = "",
                Poolkey          = "",
                PoolName         = simGroup.IsolatedNw1IpPool
            };

            _radiusRepository.CreateRadippool(radippool);
        }
        public void CreateDataCase09()
        {
            CreateBaseData();
            Organization.StartDate       = CurrentDateTimeForEnd.Item1;   // '実行日より過去
            Organization.EndDate         = CurrentDateTimeForStart.Item1; // '実行日と同日
            SimGroup1.IsolatedNw1IpRange = "192.168.1.0/30";              // '有効ホストIP数=2個(サブネット = 30bit)※NIP最小アドレス
            var radgroupcheck1 = new Radgroupcheck()                      // SimGroupいるの Radgroupcheck Radgroupreply
            {
                Attribute = "Pool-Name",
                Groupname = SimGroup1.Id.ToString(),
                Op        = ":=",
                Value     = SimGroup1.IsolatedNw1IpPool
            };
            var radgroupcheck2 = new Radgroupcheck()
            {
                Attribute = "Called-Station-Id",
                Groupname = SimGroup1.Id.ToString(),
                Op        = "==",
                Value     = SimGroup1.Apn
            };
            var radgroupcheck3 = new Radgroupcheck()
            {
                Attribute = "NAS-IP-Address",
                Groupname = SimGroup1.Id.ToString(),
                Op        = "==",
                Value     = SimGroup1.NasIp
            };
            var radgroupreply1 = new Radgroupreply()
            {
                Attribute = "MS-Primary-DNS-Server",
                Groupname = SimGroup1.Id.ToString(),
                Op        = ":=",
                Value     = SimGroup1.PrimaryDns
            };
            var radgroupreply2 = new Radgroupreply()
            {
                Attribute = "MS-Secondary-DNS-Server",
                Groupname = SimGroup1.Id.ToString(),
                Op        = ":=",
                Value     = SimGroup1.SecondaryDns
            };
            var radcheck1 = new Radcheck()  // SimいるのRadcheckとRadusergroup
            {
                Username  = Sim1.UserName + "@" + Sim1.SimGroup.UserNameSuffix,
                Attribute = "Cleartext-Password",
                Op        = ":=",
                Value     = Sim1.Password
            };
            var radcheck2 = new Radcheck()
            {
                Username  = Sim1.UserName + "@" + Sim1.SimGroup.UserNameSuffix,
                Attribute = "Calling-Station-Id",
                Op        = "==",
                Value     = Sim1.Msisdn
            };
            var radusergroup = new Radusergroup()
            {
                Username  = Sim1.UserName + "@" + Sim1.SimGroup.UserNameSuffix,
                Groupname = Sim1.SimGroup.Id.ToString()
            };
            var radippool = new Radippool()
            {
                Framedipaddress  = "192.168.1.1", //'Simgroup1のCIDR別有効ホストIP範囲に含まれる
                Nasipaddress     = "",
                Calledstationid  = "",
                Callingstationid = "",
                Username         = "",
                Poolkey          = "",
                PoolName         = SimGroup1.IsolatedNw1IpPool
            };
            var radippool2 = new Radippool()
            {
                Framedipaddress  = "192.168.1.100", //'Simgroup1のCIDR別有効ホストIP範囲に含まれない
                Nasipaddress     = "",
                Calledstationid  = "",
                Callingstationid = "",
                Username         = "",
                Poolkey          = "",
                PoolName         = SimGroup1.IsolatedNw1IpPool
            };

            SetDataForNotSim();
            RadiusDbContext.AddRange(radgroupcheck1, radgroupcheck2, radgroupcheck3, radgroupreply1, radgroupreply2,
                                     radcheck1, radcheck2, radusergroup, radippool, radippool2);

            MainDbContext.Sim.Add(new Sim()
            {
                Msisdn   = "111111111",
                Imsi     = "11111111111",
                IccId    = "1111111111",
                UserName = "******",
                Password = "******",
                SimGroup = SimGroup1
            });
            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }