aboutsummaryrefslogtreecommitdiffstats
path: root/notes/projects/radius/sql/ippool-demo.sql
blob: e6eb48aa2a8f4f80fafb51f0a8a7b3fcdf59f389 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 *  IP Engineering RADIUS Servers
 *
 *  ippool-demo.sql - inserts demo data into  RADIUS IP Pools database
 *
 *  Usage:  psql -f ippool-demo.sql radius_ippool
 *
 */


SET ROLE radius;


-- create example pools
INSERT INTO pool ( name ) VALUES ( 'DHCP' );
INSERT INTO pool ( name ) VALUES ( 'PPPoE' );
INSERT INTO pool ( name ) VALUES ( 'reserved' );


-- create example regions
INSERT INTO region ( name ) VALUES ( 'Anchorage' );
INSERT INTO region ( name ) VALUES ( 'Soldotna' );
INSERT INTO region ( name ) VALUES ( 'Fairbanks' );
INSERT INTO region ( name ) VALUES ( 'No where' );


-- create example NAS clients
SELECT nas_add( nasName := 'br1.cwc',  regionName := 'Anchorage' );
SELECT nas_add( nasName := 'bras.eng', regionName := 'Anchorage' );
SELECT nas_add( nasName := 'br1.sol',  regionName := 'Soldotna' );


-- Create example netblocks
SELECT              netblock_add
                    ( netAddress    := '209.193.4.0/28',
                      poolName      := 'DHCP',
                      regionName    := 'Soldotna'
                    );
SELECT              netblock_add
                    ( netAddress    := '209.193.4.0/29',
                      poolName      := 'DHCP',
                      regionName    := 'Soldotna',
                      netDesc       := 'Reserved for engineering test accounts',
                      netActive     := FALSE
                    );
SELECT              netblock_add
                    ( netAddress    := '209.193.4.4/30',
                      poolName      := 'DHCP',
                      regionName    := 'Soldotna'
                    );
--
SELECT              netblock_add
                    ( netAddress    := '209.193.4.16/28',
                      poolName      := 'DHCP'
                    );
SELECT              netblock_add
                    ( netAddress    := '209.193.4.32/28',
                      poolName      := 'DHCP',
                      regionName    := 'Anchorage'
                    );
SELECT              netblock_add
                    ( netAddress    := '209.193.4.48/28',
                      poolName      := 'DHCP',
                      regionName    := 'Fairbanks'
                    );
SELECT              netblock_add
                    ( netAddress    := '209.193.4.64/26',
                      poolName      := 'DHCP',
                      netDesc       := 'Reserved for documentation',
                      netActive     := FALSE,
                      addIpEntries  := FALSE
                    );
SELECT              netblock_add
                    ( netAddress    := '209.193.4.128/26',
                      poolName      := 'PPPoE',
                      regionName    := 'Soldotna'
                    );
SELECT              netblock_add
                    ( netAddress    := '209.193.4.192/26',
                      poolName      := 'PPPoE',
                      regionName    := 'Anchorage'
                    );


-- create example explicit IP reservations
SELECT              ip_assign
                    ( assignIp      := '209.193.4.8/32',
                      assignNas     := 'br1.sol',
                      assignUser    := 'jdoe8@example.net',
                      assignSess    := 'aqaqqaasdqweaasdqa8'
                    );
SELECT              ip_assign
                    ( assignIp      := '209.193.4.9/32',
                      assignNas     := 'br1.sol',
                      assignUser    := 'jdoe9@aexample.net',
                      assignSess    := 'qweadszcxqweasdzcx9'
                    );
SELECT              ip_assign
                    ( assignIp      := '209.193.4.10/32',
                      assignNas     := 'br1.sol',
                      assignUser    := 'jdoe10@example.net'
                    );
SELECT              ip_assign
                    ( assignIp      := '209.193.4.11/32',
                      assignNas     := 'br1.sol',
                      assignUser    := 'jdoe11@example.net'
                    );
SELECT              ip_assign
                    ( assignIp      := '209.193.4.12/32',
                      assignNas     := 'br1.sol',
                      assignUser    := 'jdoe12@example.net'
                    );
SELECT              ip_assign
                    ( assignIp      := '209.193.4.13/32',
                      assignNas     := 'br1.sol',
                      assignUser    := 'jdoe13@example.net'
                    );


-- add missing IP addresses to netblock
-- SELECT              ip_add_network( ipNetwork := '209.112.192.0/19' );
-- SELECT              ip_add_network( ipNetwork := '209.112.128.0/18' );


/* end of sql */