--
--


SELECT pg_catalog.set_config('search_path', '', false);

--
-- Name: curdate(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.curdate() RETURNS date
    LANGUAGE plpgsql
    AS $$
BEGIN
RETURN current_date;
END; $$;


ALTER FUNCTION public.curdate() OWNER TO postgres;

--
-- Name: fr_new_data_usage_period(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.fr_new_data_usage_period() RETURNS void
    LANGUAGE plpgsql
    AS $$
DECLARE v_start timestamp;
DECLARE v_end timestamp;
BEGIN

    SELECT COALESCE(MAX(period_start), TO_TIMESTAMP(0)) INTO v_start FROM data_usage_by_period;
    SELECT DATE_TRUNC('second',CURRENT_TIMESTAMP) INTO v_end;

    --
    -- Add the data usage for the sessions that were active in the current
    -- period to the table. Include all sessions that finished since the start
    -- of this period as well as those still ongoing.
    --
    INSERT INTO data_usage_by_period (username, period_start, period_end, acctinputoctets, acctoutputoctets)
    SELECT *
    FROM (
        SELECT
            username,
            v_start,
            v_end,
            SUM(acctinputoctets) AS acctinputoctets,
            SUM(acctoutputoctets) AS acctoutputoctets
        FROM
            radacct
        WHERE
            acctstoptime > v_start OR
            acctstoptime IS NULL
        GROUP BY
            username
    ) AS s
    ON CONFLICT ON CONSTRAINT data_usage_by_period_pkey
    DO UPDATE
        SET
            acctinputoctets = data_usage_by_period.acctinputoctets + EXCLUDED.acctinputoctets,
            acctoutputoctets = data_usage_by_period.acctoutputoctets + EXCLUDED.acctoutputoctets,
            period_end = v_end;

    --
    -- Create an open-ended "next period" for all ongoing sessions and carry a
    -- negative value of their data usage to avoid double-accounting when we
    -- process the next period. Their current data usage has already been
    -- allocated to the current and possibly previous periods.
    --
    INSERT INTO data_usage_by_period (username, period_start, period_end, acctinputoctets, acctoutputoctets)
    SELECT *
    FROM (
        SELECT
            username,
            v_end + INTERVAL '1 SECOND',
            NULL::timestamp,
            0 - SUM(acctinputoctets),
            0 - SUM(acctoutputoctets)
        FROM
            radacct
        WHERE
            acctstoptime IS NULL
        GROUP BY
            username
    ) AS s;

END
$$;


ALTER FUNCTION public.fr_new_data_usage_period() OWNER TO postgres;



--
-- Name: data_usage_by_period; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.data_usage_by_period (
    username text NOT NULL,
    period_start timestamp with time zone NOT NULL,
    period_end timestamp with time zone,
    acctinputoctets bigint,
    acctoutputoctets bigint
);


ALTER TABLE public.data_usage_by_period OWNER TO postgres;

--
-- Name: nas; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.nas (
    id integer NOT NULL,
    nasname text NOT NULL,
    shortname text NOT NULL,
    type text DEFAULT 'other'::text NOT NULL,
    ports integer,
    secret text NOT NULL,
    server text,
    community text,
    description text
);


ALTER TABLE public.nas OWNER TO postgres;

--
-- Name: nas_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.nas_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.nas_id_seq OWNER TO postgres;

--
-- Name: nas_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.nas_id_seq OWNED BY public.nas.id;


--
-- Name: radacct; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.radacct (
    radacctid bigint NOT NULL,
    acctsessionid text NOT NULL,
    acctuniqueid text NOT NULL,
    username text,
    realm text,
    nasipaddress inet NOT NULL,
    nasportid text,
    nasporttype text,
    acctstarttime timestamp with time zone,
    acctupdatetime timestamp with time zone,
    acctstoptime timestamp with time zone,
    acctinterval bigint,
    acctsessiontime bigint,
    acctauthentic text,
    connectinfo_start text,
    connectinfo_stop text,
    acctinputoctets bigint,
    acctoutputoctets bigint,
    calledstationid text,
    callingstationid text,
    acctterminatecause text,
    servicetype text,
    framedprotocol text,
    framedipaddress inet,
    framedipv6address inet,
    framedipv6prefix inet,
    framedinterfaceid text,
    delegatedipv6prefix inet
);


ALTER TABLE public.radacct OWNER TO postgres;

--
-- Name: radacct_radacctid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.radacct_radacctid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.radacct_radacctid_seq OWNER TO postgres;

--
-- Name: radacct_radacctid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.radacct_radacctid_seq OWNED BY public.radacct.radacctid;


--
-- Name: radcheck; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.radcheck (
    id integer NOT NULL,
    username text DEFAULT ''::text NOT NULL,
    attribute text DEFAULT ''::text NOT NULL,
    op character varying(2) DEFAULT '=='::character varying NOT NULL,
    value text DEFAULT ''::text NOT NULL,
    created timestamp(6) with time zone NOT NULL,
    modified timestamp(6) with time zone NOT NULL,
    is_active boolean NOT NULL,
    valid_until timestamp(6) with time zone,
    notes text,
    limite_descarga_bytes bigint,
    filter_id smallint
);


ALTER TABLE public.radcheck OWNER TO postgres;

--
-- Name: radcheck_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.radcheck_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.radcheck_id_seq OWNER TO postgres;

--
-- Name: radcheck_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.radcheck_id_seq OWNED BY public.radcheck.id;


--
-- Name: radgroupcheck; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.radgroupcheck (
    id integer NOT NULL,
    groupname text DEFAULT ''::text NOT NULL,
    attribute text DEFAULT ''::text NOT NULL,
    op character varying(2) DEFAULT '=='::character varying NOT NULL,
    value text DEFAULT ''::text NOT NULL,
    created timestamp(6) with time zone NOT NULL,
    modified timestamp(6) with time zone NOT NULL
);


ALTER TABLE public.radgroupcheck OWNER TO postgres;

--
-- Name: radgroupcheck_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.radgroupcheck_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.radgroupcheck_id_seq OWNER TO postgres;

--
-- Name: radgroupcheck_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.radgroupcheck_id_seq OWNED BY public.radgroupcheck.id;


--
-- Name: radgroupreply; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.radgroupreply (
    id integer NOT NULL,
    groupname text DEFAULT ''::text NOT NULL,
    attribute text DEFAULT ''::text NOT NULL,
    op character varying(2) DEFAULT '='::character varying NOT NULL,
    value text DEFAULT ''::text NOT NULL,
    created timestamp(6) with time zone NOT NULL,
    modified timestamp(6) with time zone NOT NULL
);


ALTER TABLE public.radgroupreply OWNER TO postgres;

--
-- Name: radgroupreply_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.radgroupreply_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.radgroupreply_id_seq OWNER TO postgres;

--
-- Name: radgroupreply_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.radgroupreply_id_seq OWNED BY public.radgroupreply.id;


--
-- Name: radpostauth; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.radpostauth (
    id bigint NOT NULL,
    username text NOT NULL,
    pass text,
    reply text,
    calledstationid text,
    callingstationid text,
    authdate timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.radpostauth OWNER TO postgres;

--
-- Name: radpostauth_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.radpostauth_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.radpostauth_id_seq OWNER TO postgres;

--
-- Name: radpostauth_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.radpostauth_id_seq OWNED BY public.radpostauth.id;


--
-- Name: radreply; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.radreply (
    id integer NOT NULL,
    username text DEFAULT ''::text NOT NULL,
    attribute text DEFAULT ''::text NOT NULL,
    op character varying(2) DEFAULT '='::character varying NOT NULL,
    value text DEFAULT ''::text NOT NULL,
    created timestamp(6) with time zone NOT NULL,
    modified timestamp(6) with time zone NOT NULL
);


ALTER TABLE public.radreply OWNER TO postgres;

--
-- Name: radreply_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.radreply_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.radreply_id_seq OWNER TO postgres;

--
-- Name: radreply_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.radreply_id_seq OWNED BY public.radreply.id;


--
-- Name: radusergroup; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.radusergroup (
    id integer NOT NULL,
    username text DEFAULT ''::text NOT NULL,
    groupname text DEFAULT ''::text NOT NULL,
    priority integer DEFAULT 0 NOT NULL,
    created timestamp(6) with time zone NOT NULL,
    modified timestamp(6) with time zone NOT NULL
);


ALTER TABLE public.radusergroup OWNER TO postgres;

--
-- Name: radusergroup_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.radusergroup_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.radusergroup_id_seq OWNER TO postgres;

--
-- Name: radusergroup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.radusergroup_id_seq OWNED BY public.radusergroup.id;


--
-- Name: recharge; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.recharge (
    id integer NOT NULL,
    app_recharges_id uuid NOT NULL,
    mac character varying(20) NOT NULL
);


ALTER TABLE public.recharge OWNER TO postgres;

--
-- Name: recharge_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.recharge_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER TABLE public.recharge_id_seq OWNER TO postgres;

--
-- Name: recharge_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.recharge_id_seq OWNED BY public.recharge.id;


--
-- Name: nas id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.nas ALTER COLUMN id SET DEFAULT nextval('public.nas_id_seq'::regclass);


--
-- Name: radacct radacctid; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radacct ALTER COLUMN radacctid SET DEFAULT nextval('public.radacct_radacctid_seq'::regclass);


--
-- Name: radcheck id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radcheck ALTER COLUMN id SET DEFAULT nextval('public.radcheck_id_seq'::regclass);


--
-- Name: radgroupcheck id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radgroupcheck ALTER COLUMN id SET DEFAULT nextval('public.radgroupcheck_id_seq'::regclass);


--
-- Name: radgroupreply id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radgroupreply ALTER COLUMN id SET DEFAULT nextval('public.radgroupreply_id_seq'::regclass);


--
-- Name: radpostauth id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radpostauth ALTER COLUMN id SET DEFAULT nextval('public.radpostauth_id_seq'::regclass);


--
-- Name: radreply id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radreply ALTER COLUMN id SET DEFAULT nextval('public.radreply_id_seq'::regclass);


--
-- Name: radusergroup id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radusergroup ALTER COLUMN id SET DEFAULT nextval('public.radusergroup_id_seq'::regclass);


--
-- Name: recharge id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.recharge ALTER COLUMN id SET DEFAULT nextval('public.recharge_id_seq'::regclass);


--
-- Data for Name: data_usage_by_period; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.data_usage_by_period (username, period_start, period_end, acctinputoctets, acctoutputoctets) FROM stdin;
\.


--
-- Data for Name: nas; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.nas (id, nasname, shortname, type, ports, secret, server, community, description) FROM stdin;
2	10.52.0.10	aaa-activo1-prod	Other	39414	wowperu2020			Paquetes de LIM-ITX-NE40E-M2K-BRAS-Prod
1	10.52.0.28	aaa-activo1-test	Other	39414	wowperu2020			Paquetes de LIM-ITX-NE40E-M2K-BRAS
\.


--
-- Data for Name: radacct; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.radacct (radacctid, acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctinterval, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress, framedipv6address, framedipv6prefix, framedinterfaceid, delegatedipv6prefix) FROM stdin;
\.


--
-- Data for Name: radcheck; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.radcheck (id, username, attribute, op, value, created, modified, is_active, valid_until, notes, limite_descarga_bytes, filter_id) FROM stdin;
1	test@woperu	Cleartext-Password	:=	wowperu123	2020-04-23 16:34:50.92804-05	2020-04-23 17:10:12.372112-05	t	2020-06-30 00:00:00-05	ont	1	1
75	E00084A2CEC1	Cleartext-Password	:=	E00084A2CEC1	2020-05-05 11:30:01-05	2020-05-11 21:13:43-05	t	2020-05-14 10:59:59-05	Cleartext-Password	\N	\N
78	FF00FF00FF05	Cleartext-Password	:=	FF00FF00FF05	2020-05-12 12:04:43-05	2020-05-12 12:04:43-05	t	2020-05-15 23:59:59-05	Cleartext-Password	\N	\N
76	E00084A2C344	Cleartext-Password	:=	E00084A2C344	2020-05-12 10:18:34-05	2020-05-13 11:05:34-05	t	2020-05-13 23:59:59-05	Cleartext-Password	\N	\N
77	E00084A2CF16	Cleartext-Password	:=	E00084A2CF16	2020-05-12 10:19:04-05	2020-05-13 11:05:47-05	t	2020-05-13 23:59:59-05	Cleartext-Password	\N	\N
86	535352442328	Cleartext-Password	:=	535352442328	2020-05-25 11:06:52-05	2020-05-25 11:08:49-05	t	2020-06-09 23:59:59-05	Cleartext-Password	\N	\N
80	252525252530	Cleartext-Password	:=	252525252530	2020-05-22 17:06:10-05	2020-05-22 17:08:09-05	t	2020-11-22 23:59:59-05	Cleartext-Password	\N	\N
87	12341512341B	Cleartext-Password	:=	12341512341B	2020-05-25 11:59:46-05	2020-05-25 11:59:46-05	t	2020-05-27 23:59:59-05	Cleartext-Password	\N	\N
88	ACDF34124226	Cleartext-Password	:=	ACDF34124226	2020-05-25 12:00:37-05	2020-05-25 12:01:08-05	t	2020-08-05 04:59:59-05	Cleartext-Password	\N	\N
85	65A345345228	Cleartext-Password	:=	65A345345228	2020-05-25 09:21:06-05	2020-05-25 12:03:56-05	t	2020-06-11 22:17:00-05	Cleartext-Password	\N	\N
81	25252525252A	Cleartext-Password	:=	25252525252A	2020-05-22 17:14:21-05	2020-05-22 20:48:22-05	t	2020-07-23 11:59:59-05	Cleartext-Password	\N	\N
82	64378765423A	Cleartext-Password	:=	64378765423A	2020-05-22 19:44:32-05	2020-05-22 20:48:42-05	t	2020-06-22 09:59:59-05	Cleartext-Password	\N	\N
79	754735436359	Cleartext-Password	:=	754735436359	2020-05-22 14:05:04-05	2020-05-25 09:02:33-05	t	2020-12-02 23:59:59-05	Cleartext-Password	\N	\N
84	52525252525A	Cleartext-Password	:=	52525252525A	2020-05-25 08:24:02-05	2020-05-25 09:24:31-05	t	2020-06-15 23:59:59-05	Cleartext-Password	\N	\N
100	AFC1234567B3	Cleartext-Password	:=	AFC1234567B3	2020-05-25 17:07:53-05	2020-05-25 17:16:34-05	t	2020-07-05 14:59:59-05	Cleartext-Password	\N	\N
83	71789783187B	Cleartext-Password	:=	71789783187B	2020-05-25 08:21:42-05	2020-05-25 09:41:27-05	t	2024-06-14 23:59:59-05	Cleartext-Password	\N	\N
\.


--
-- Data for Name: radgroupcheck; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.radgroupcheck (id, groupname, attribute, op, value, created, modified) FROM stdin;
\.


--
-- Data for Name: radgroupreply; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.radgroupreply (id, groupname, attribute, op, value, created, modified) FROM stdin;
1	netdial	Framed-Protocol	:=	PPP	2020-04-03 16:43:12.741936-05	2020-05-14 17:09:39.501272-05
2	netdial	Service-Type	:=	Framed-User	2020-04-03 16:43:12.741936-05	2020-05-14 17:09:39.501272-05
\.


--
-- Data for Name: radpostauth; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.radpostauth (id, username, pass, reply, calledstationid, callingstationid, authdate) FROM stdin;
\.


--
-- Data for Name: radreply; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.radreply (id, username, attribute, op, value, created, modified) FROM stdin;
1	test@woperu	Huawei-Qos-Profile-Name	+=	20M-10Mup	2020-04-03 16:43:12.741936-05	2020-05-14 17:09:39.501272-05
2	test@woperu	Huawei-Down-QOS-Profile-Name	+=	20M-10Mdown	2020-04-03 16:43:12.741936-05	2020-05-14 17:09:39.501272-05
145	E00084A2C344	Huawei-User-Mac	+=	E0:00:84:A2:C3:44	2020-05-13 11:05:34-05	2020-05-13 11:05:34-05
146	E00084A2C344	Huawei-Down-QOS-Profile-Name	+=	300M-150Mdown	2020-05-13 11:05:34-05	2020-05-13 11:05:34-05
147	E00084A2C344	Huawei-QOS-Profile-Name	+=	300M-150Mup	2020-05-13 11:05:34-05	2020-05-13 11:05:34-05
148	E00084A2C344	Filter-id	+=	0	2020-05-13 11:05:34-05	2020-05-13 11:05:34-05
149	E00084A2CF16	Huawei-User-Mac	+=	E0:00:84:A2:CF:16	2020-05-13 11:05:47-05	2020-05-13 11:05:47-05
150	E00084A2CF16	Huawei-Down-QOS-Profile-Name	+=	300M-150Mdown	2020-05-13 11:05:47-05	2020-05-13 11:05:47-05
151	E00084A2CF16	Huawei-QOS-Profile-Name	+=	300M-150Mup	2020-05-13 11:05:47-05	2020-05-13 11:05:47-05
152	E00084A2CF16	Filter-id	+=	0	2020-05-13 11:05:47-05	2020-05-13 11:05:47-05
365	12341512341B	Huawei-User-Mac	+=	12:34:15:12:34:1B	2020-05-25 11:59:46-05	2020-05-25 11:59:46-05
366	12341512341B	Huawei-Down-QOS-Profile-Name	+=	10M-10Mdown	2020-05-25 11:59:46-05	2020-05-25 11:59:46-05
367	12341512341B	Huawei-QOS-Profile-Name	+=	10M-10Mup	2020-05-25 11:59:46-05	2020-05-25 11:59:46-05
368	12341512341B	Filter-id	+=	0	2020-05-25 11:59:46-05	2020-05-25 11:59:46-05
105	E00084A2CEC1	Huawei-User-Mac	+=	E0:00:84:A2:CE:C1	2020-05-11 21:13:43-05	2020-05-11 21:13:43-05
106	E00084A2CEC1	Huawei-Down-QOS-Profile-Name	+=	50M-50Mdown	2020-05-11 21:13:43-05	2020-05-11 21:13:43-05
107	E00084A2CEC1	Huawei-QOS-Profile-Name	+=	50M-50Mup	2020-05-11 21:13:43-05	2020-05-11 21:13:43-05
108	E00084A2CEC1	Filter-id	+=	0	2020-05-11 21:13:43-05	2020-05-11 21:13:43-05
117	FF00FF00FF05	Huawei-User-Mac	+=	FF:00:FF:00:FF:05	2020-05-12 12:04:43-05	2020-05-12 12:04:43-05
118	FF00FF00FF05	Huawei-Down-QOS-Profile-Name	+=	10M-10Mdown	2020-05-12 12:04:43-05	2020-05-12 12:04:43-05
119	FF00FF00FF05	Huawei-QOS-Profile-Name	+=	10M-10Mup	2020-05-12 12:04:43-05	2020-05-12 12:04:43-05
120	FF00FF00FF05	Filter-id	+=	16	2020-05-12 12:04:43-05	2020-05-12 12:04:43-05
301	71789783187B	Huawei-User-Mac	+=	71:78:97:83:18:7B	2020-05-25 09:41:27-05	2020-05-25 09:41:27-05
302	71789783187B	Huawei-Down-QOS-Profile-Name	+=	10M-10Mdown	2020-05-25 09:41:27-05	2020-05-25 09:41:27-05
303	71789783187B	Huawei-QOS-Profile-Name	+=	10M-10Mup	2020-05-25 09:41:27-05	2020-05-25 09:41:27-05
304	71789783187B	Filter-id	+=	0	2020-05-25 09:41:27-05	2020-05-25 09:41:27-05
373	ACDF34124226	Huawei-User-Mac	+=	AC:DF:34:12:42:26	2020-05-25 12:01:08-05	2020-05-25 12:01:08-05
374	ACDF34124226	Huawei-Down-QOS-Profile-Name	+=	10M-10Mdown	2020-05-25 12:01:08-05	2020-05-25 12:01:08-05
375	ACDF34124226	Huawei-QOS-Profile-Name	+=	10M-10Mup	2020-05-25 12:01:08-05	2020-05-25 12:01:08-05
376	ACDF34124226	Filter-id	+=	0	2020-05-25 12:01:08-05	2020-05-25 12:01:08-05
377	65A345345228	Huawei-User-Mac	+=	65:A3:45:34:52:28	2020-05-25 12:03:56-05	2020-05-25 12:03:56-05
378	65A345345228	Huawei-Down-QOS-Profile-Name	+=	10M-10Mdown	2020-05-25 12:03:56-05	2020-05-25 12:03:56-05
379	65A345345228	Huawei-QOS-Profile-Name	+=	10M-10Mup	2020-05-25 12:03:56-05	2020-05-25 12:03:56-05
380	65A345345228	Filter-id	+=	0	2020-05-25 12:03:56-05	2020-05-25 12:03:56-05
241	25252525252A	Huawei-User-Mac	+=	25:25:25:25:25:2A	2020-05-22 20:48:22-05	2020-05-22 20:48:22-05
242	25252525252A	Huawei-Down-QOS-Profile-Name	+=	10M-10Mdown	2020-05-22 20:48:22-05	2020-05-22 20:48:22-05
243	25252525252A	Huawei-QOS-Profile-Name	+=	10M-10Mup	2020-05-22 20:48:22-05	2020-05-22 20:48:22-05
244	25252525252A	Filter-id	+=	0	2020-05-22 20:48:22-05	2020-05-22 20:48:22-05
245	64378765423A	Huawei-User-Mac	+=	64:37:87:65:42:3A	2020-05-22 20:48:42-05	2020-05-22 20:48:42-05
246	64378765423A	Huawei-Down-QOS-Profile-Name	+=	50M-50Mdown	2020-05-22 20:48:42-05	2020-05-22 20:48:42-05
247	64378765423A	Huawei-QOS-Profile-Name	+=	50M-50Mup	2020-05-22 20:48:42-05	2020-05-22 20:48:42-05
248	64378765423A	Filter-id	+=	0	2020-05-22 20:48:42-05	2020-05-22 20:48:42-05
257	754735436359	Huawei-User-Mac	+=	75:47:35:43:63:59	2020-05-25 09:02:33-05	2020-05-25 09:02:33-05
258	754735436359	Huawei-Down-QOS-Profile-Name	+=	500M-500Mdown	2020-05-25 09:02:33-05	2020-05-25 09:02:33-05
259	754735436359	Huawei-QOS-Profile-Name	+=	500M-500Mup	2020-05-25 09:02:33-05	2020-05-25 09:02:33-05
260	754735436359	Filter-id	+=	0	2020-05-25 09:02:33-05	2020-05-25 09:02:33-05
325	535352442328	Huawei-User-Mac	+=	53:53:52:44:23:28	2020-05-25 11:08:49-05	2020-05-25 11:08:49-05
326	535352442328	Huawei-Down-QOS-Profile-Name	+=	10M-10Mdown	2020-05-25 11:08:49-05	2020-05-25 11:08:49-05
327	535352442328	Huawei-QOS-Profile-Name	+=	10M-10Mup	2020-05-25 11:08:49-05	2020-05-25 11:08:49-05
328	535352442328	Filter-id	+=	0	2020-05-25 11:08:49-05	2020-05-25 11:08:49-05
197	252525252530	Huawei-User-Mac	+=	25:25:25:25:25:30	2020-05-22 17:06:10-05	2020-05-22 17:06:10-05
198	252525252530	Huawei-Down-QOS-Profile-Name	+=	500M-500Mdown	2020-05-22 17:06:10-05	2020-05-22 17:06:10-05
199	252525252530	Huawei-QOS-Profile-Name	+=	500M-500Mup	2020-05-22 17:06:10-05	2020-05-22 17:06:10-05
200	252525252530	Filter-id	+=	0	2020-05-22 17:06:10-05	2020-05-22 17:06:10-05
525	AFC1234567B3	Huawei-User-Mac	+=	AF:C1:23:45:67:B3	2020-05-25 17:16:34-05	2020-05-25 17:16:34-05
526	AFC1234567B3	Huawei-Down-QOS-Profile-Name	+=	250M-250Mdown	2020-05-25 17:16:34-05	2020-05-25 17:16:34-05
527	AFC1234567B3	Huawei-QOS-Profile-Name	+=	250M-250Mup	2020-05-25 17:16:34-05	2020-05-25 17:16:34-05
528	AFC1234567B3	Filter-id	+=	0	2020-05-25 17:16:34-05	2020-05-25 17:16:34-05
285	52525252525A	Huawei-User-Mac	+=	52:52:52:52:52:5A	2020-05-25 09:24:31-05	2020-05-25 09:24:31-05
286	52525252525A	Huawei-Down-QOS-Profile-Name	+=	10M-130Mdown	2020-05-25 09:24:31-05	2020-05-25 09:24:31-05
287	52525252525A	Huawei-QOS-Profile-Name	+=	10M-130Mup	2020-05-25 09:24:31-05	2020-05-25 09:24:31-05
288	52525252525A	Filter-id	+=	0	2020-05-25 09:24:31-05	2020-05-25 09:24:31-05
\.


--
-- Data for Name: radusergroup; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.radusergroup (id, username, groupname, priority, created, modified) FROM stdin;
1	test@woperu	netdial	1	2020-04-03 16:43:12.741936-05	2020-05-14 17:09:39.501272-05
\.


--
-- Data for Name: recharge; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.recharge (id, app_recharges_id, mac) FROM stdin;
27	bb4e089d-3356-47c1-9680-49dd37a3346a	E00084A2CEC1
30	353341f6-6333-4b37-bc33-3824f66c9916	FF00FF00FF05
37	de183d47-2e3e-4b5f-90d2-6b6425971635	E00084A2C344
38	56ef8102-cc6f-4bfa-9088-616f197f2130	E00084A2CF16
50	52ee4024-641d-44b5-802a-e6e1a8309b37	252525252530
61	831759c3-f858-4f45-9340-87ffa772f122	25252525252A
62	8278f3cf-5ae1-48fa-9666-dab601d92285	64378765423A
65	9a7bbb29-1400-4054-9688-727d0c9c768e	754735436359
72	226c85c2-0906-47d0-b4ba-62343bbcd994	52525252525A
132	a34136bf-a586-400c-a65e-1ca34aa99e79	AFC1234567B3
76	79c31373-8ff2-4bb9-b2ea-1efb1db5c0a2	71789783187B
82	6b894f8a-b7b3-42c1-9d83-2d94aeee07f9	535352442328
92	8478ae2a-280b-48f7-a840-ad56f41df3ba	12341512341B
94	c0819518-36ba-4537-82bd-c0e89645aba9	ACDF34124226
95	b54fa869-a573-4f44-8141-402a347e2204	65A345345228
\.


--
-- Name: nas_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.nas_id_seq', 1, false);


--
-- Name: radacct_radacctid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.radacct_radacctid_seq', 1, false);


--
-- Name: radcheck_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.radcheck_id_seq', 100, true);


--
-- Name: radgroupcheck_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.radgroupcheck_id_seq', 1, false);


--
-- Name: radgroupreply_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.radgroupreply_id_seq', 1, false);


--
-- Name: radpostauth_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.radpostauth_id_seq', 1, false);


--
-- Name: radreply_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.radreply_id_seq', 528, true);


--
-- Name: radusergroup_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.radusergroup_id_seq', 1, false);


--
-- Name: recharge_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.recharge_id_seq', 132, true);


--
-- Name: data_usage_by_period data_usage_by_period_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.data_usage_by_period
    ADD CONSTRAINT data_usage_by_period_pkey PRIMARY KEY (username, period_start);


--
-- Name: nas nas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.nas
    ADD CONSTRAINT nas_pkey PRIMARY KEY (id);


--
-- Name: radacct radacct_acctuniqueid_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radacct
    ADD CONSTRAINT radacct_acctuniqueid_key UNIQUE (acctuniqueid);


--
-- Name: radacct radacct_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radacct
    ADD CONSTRAINT radacct_pkey PRIMARY KEY (radacctid);


--
-- Name: radcheck radcheck_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radcheck
    ADD CONSTRAINT radcheck_pkey PRIMARY KEY (id);


--
-- Name: radgroupcheck radgroupcheck_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radgroupcheck
    ADD CONSTRAINT radgroupcheck_pkey PRIMARY KEY (id);


--
-- Name: radgroupreply radgroupreply_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radgroupreply
    ADD CONSTRAINT radgroupreply_pkey PRIMARY KEY (id);


--
-- Name: radpostauth radpostauth_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radpostauth
    ADD CONSTRAINT radpostauth_pkey PRIMARY KEY (id);


--
-- Name: radreply radreply_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radreply
    ADD CONSTRAINT radreply_pkey PRIMARY KEY (id);


--
-- Name: radusergroup radusergroup_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.radusergroup
    ADD CONSTRAINT radusergroup_pkey PRIMARY KEY (id);


--
-- Name: recharge recharge_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.recharge
    ADD CONSTRAINT recharge_pkey PRIMARY KEY (id);


--
-- Name: nas_nasname; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX nas_nasname ON public.nas USING btree (nasname);


--
-- Name: radacct_active_session_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radacct_active_session_idx ON public.radacct USING btree (acctuniqueid) WHERE (acctstoptime IS NULL);


--
-- Name: radacct_bulk_close; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radacct_bulk_close ON public.radacct USING btree (nasipaddress, acctstarttime) WHERE (acctstoptime IS NULL);


--
-- Name: radacct_start_user_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radacct_start_user_idx ON public.radacct USING btree (acctstarttime, username);


--
-- Name: radcheck_username; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radcheck_username ON public.radcheck USING btree (username, attribute);


--
-- Name: radcheck_username_761f015c; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radcheck_username_761f015c ON public.radcheck USING btree (username);


--
-- Name: radcheck_username_761f015c_like; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radcheck_username_761f015c_like ON public.radcheck USING btree (username varchar_pattern_ops);


--
-- Name: radgroupcheck_groupname; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radgroupcheck_groupname ON public.radgroupcheck USING btree (groupname, attribute);


--
-- Name: radgroupreply_groupname; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radgroupreply_groupname ON public.radgroupreply USING btree (groupname, attribute);


--
-- Name: radreply_username; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radreply_username ON public.radreply USING btree (username, attribute);


--
-- Name: radusergroup_username; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX radusergroup_username ON public.radusergroup USING btree (username);


--
-- Name: TABLE nas; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT ON TABLE public.nas TO radius;


--
-- Name: SEQUENCE nas_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,USAGE ON SEQUENCE public.nas_id_seq TO radius;


--
-- Name: TABLE radacct; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,INSERT,UPDATE ON TABLE public.radacct TO radius;


--
-- Name: SEQUENCE radacct_radacctid_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,USAGE ON SEQUENCE public.radacct_radacctid_seq TO radius;


--
-- Name: TABLE radcheck; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT ON TABLE public.radcheck TO radius;


--
-- Name: SEQUENCE radcheck_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,USAGE ON SEQUENCE public.radcheck_id_seq TO radius;


--
-- Name: TABLE radgroupcheck; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT ON TABLE public.radgroupcheck TO radius;


--
-- Name: SEQUENCE radgroupcheck_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,USAGE ON SEQUENCE public.radgroupcheck_id_seq TO radius;


--
-- Name: TABLE radgroupreply; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT ON TABLE public.radgroupreply TO radius;


--
-- Name: SEQUENCE radgroupreply_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,USAGE ON SEQUENCE public.radgroupreply_id_seq TO radius;


--
-- Name: TABLE radpostauth; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,INSERT,UPDATE ON TABLE public.radpostauth TO radius;


--
-- Name: SEQUENCE radpostauth_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,USAGE ON SEQUENCE public.radpostauth_id_seq TO radius;


--
-- Name: TABLE radreply; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT ON TABLE public.radreply TO radius;


--
-- Name: SEQUENCE radreply_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,USAGE ON SEQUENCE public.radreply_id_seq TO radius;


--
-- Name: TABLE radusergroup; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT ON TABLE public.radusergroup TO radius;


--
-- Name: SEQUENCE radusergroup_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT SELECT,USAGE ON SEQUENCE public.radusergroup_id_seq TO radius;


--
--

