Committed by
Gerrit Code Review
Removing a very old CORD GUI demo app.
Change-Id: I1039d5acc145f51f930dee28c5895b9593070628
Showing
91 changed files
with
0 additions
and
4322 deletions
apps/demo/cord-gui/pom.xml
deleted
100644 → 0
1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
2 | -<!-- | ||
3 | - ~ Copyright 2015-present Open Networking Laboratory | ||
4 | - ~ | ||
5 | - ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | - ~ you may not use this file except in compliance with the License. | ||
7 | - ~ You may obtain a copy of the License at | ||
8 | - ~ | ||
9 | - ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | - ~ | ||
11 | - ~ Unless required by applicable law or agreed to in writing, software | ||
12 | - ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | - ~ See the License for the specific language governing permissions and | ||
15 | - ~ limitations under the License. | ||
16 | - --> | ||
17 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
20 | - <modelVersion>4.0.0</modelVersion> | ||
21 | - | ||
22 | - <parent> | ||
23 | - <groupId>org.onosproject</groupId> | ||
24 | - <artifactId>onos-base</artifactId> | ||
25 | - <version>1</version> | ||
26 | - <relativePath>../../../tools/build/pom.xml</relativePath> | ||
27 | - </parent> | ||
28 | - | ||
29 | - <artifactId>cord-gui</artifactId> | ||
30 | - <version>1.8.0-SNAPSHOT</version> | ||
31 | - <packaging>war</packaging> | ||
32 | - | ||
33 | - <description>Demo CORD Subscriber Web GUI</description> | ||
34 | - | ||
35 | - <properties> | ||
36 | - <web.context>/cord</web.context> | ||
37 | - </properties> | ||
38 | - | ||
39 | - <dependencies> | ||
40 | - <dependency> | ||
41 | - <groupId>javax.servlet</groupId> | ||
42 | - <artifactId>servlet-api</artifactId> | ||
43 | - <version>2.5</version> | ||
44 | - </dependency> | ||
45 | - | ||
46 | - <dependency> | ||
47 | - <groupId>org.glassfish.jersey.containers</groupId> | ||
48 | - <artifactId>jersey-container-servlet</artifactId> | ||
49 | - <version>2.22.2</version> | ||
50 | - </dependency> | ||
51 | - <dependency> | ||
52 | - <groupId>org.glassfish.jersey.core</groupId> | ||
53 | - <artifactId>jersey-client</artifactId> | ||
54 | - <version>2.22.2</version> | ||
55 | - </dependency> | ||
56 | - | ||
57 | - <dependency> | ||
58 | - <groupId>org.slf4j</groupId> | ||
59 | - <artifactId>slf4j-api</artifactId> | ||
60 | - <version>1.7.21</version> | ||
61 | - </dependency> | ||
62 | - | ||
63 | - <dependency> | ||
64 | - <groupId>org.slf4j</groupId> | ||
65 | - <artifactId>slf4j-jdk14</artifactId> | ||
66 | - <version>1.7.21</version> | ||
67 | - </dependency> | ||
68 | - | ||
69 | - <dependency> | ||
70 | - <groupId>commons-io</groupId> | ||
71 | - <artifactId>commons-io</artifactId> | ||
72 | - <version>2.4</version> | ||
73 | - </dependency> | ||
74 | - <dependency> | ||
75 | - <groupId>com.fasterxml.jackson.core</groupId> | ||
76 | - <artifactId>jackson-core</artifactId> | ||
77 | - <version>2.7.3</version> | ||
78 | - </dependency> | ||
79 | - <dependency> | ||
80 | - <groupId>com.fasterxml.jackson.core</groupId> | ||
81 | - <artifactId>jackson-databind</artifactId> | ||
82 | - <version>2.7.3</version> | ||
83 | - </dependency> | ||
84 | - <dependency> | ||
85 | - <groupId>com.google.guava</groupId> | ||
86 | - <artifactId>guava</artifactId> | ||
87 | - <version>19.0</version> | ||
88 | - </dependency> | ||
89 | - </dependencies> | ||
90 | - | ||
91 | - <build> | ||
92 | - <pluginManagement> | ||
93 | - <plugins> | ||
94 | - <plugin> | ||
95 | - <groupId>org.apache.maven.plugins</groupId> | ||
96 | - <artifactId>maven-compiler-plugin</artifactId> | ||
97 | - <!-- TODO: update once following issue is fixed. --> | ||
98 | - <!-- https://jira.codehaus.org/browse/MCOMPILER-205 --> | ||
99 | - <version>2.5.1</version> | ||
100 | - <configuration> | ||
101 | - <source>1.7</source> | ||
102 | - <target>1.7</target> | ||
103 | - </configuration> | ||
104 | - </plugin> | ||
105 | - </plugins> | ||
106 | - </pluginManagement> | ||
107 | - </build> | ||
108 | - | ||
109 | -</project> |
This diff is collapsed. Click to expand it.
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -package org.onosproject.cord.gui; | ||
18 | - | ||
19 | -import javax.ws.rs.GET; | ||
20 | -import javax.ws.rs.Path; | ||
21 | -import javax.ws.rs.PathParam; | ||
22 | -import javax.ws.rs.Produces; | ||
23 | -import javax.ws.rs.core.MediaType; | ||
24 | -import javax.ws.rs.core.Response; | ||
25 | - | ||
26 | -/** | ||
27 | - * Web resource to use as the GUI back-end and as a proxy to XOS REST API. | ||
28 | - */ | ||
29 | -@Path("") | ||
30 | -public class CordWebResource { | ||
31 | - | ||
32 | - @GET | ||
33 | - @Produces(MediaType.APPLICATION_JSON) | ||
34 | - @Path("login/{email}") | ||
35 | - public Response login(@PathParam("email") String email) { | ||
36 | - return Response.ok(CordModelCache.INSTANCE.jsonLogin(email)).build(); | ||
37 | - } | ||
38 | - | ||
39 | - @GET | ||
40 | - @Produces(MediaType.APPLICATION_JSON) | ||
41 | - @Path("dashboard") | ||
42 | - public Response dashboard() { | ||
43 | - return Response.ok(CordModelCache.INSTANCE.jsonDashboard()).build(); | ||
44 | - } | ||
45 | - | ||
46 | - @GET | ||
47 | - @Produces(MediaType.APPLICATION_JSON) | ||
48 | - @Path("bundle") | ||
49 | - public Response bundle() { | ||
50 | - return Response.ok(CordModelCache.INSTANCE.jsonBundle()).build(); | ||
51 | - } | ||
52 | - | ||
53 | - @GET | ||
54 | - @Produces(MediaType.APPLICATION_JSON) | ||
55 | - @Path("users") | ||
56 | - public Response users() { | ||
57 | - return Response.ok(CordModelCache.INSTANCE.jsonUsers()).build(); | ||
58 | - } | ||
59 | - | ||
60 | - @GET | ||
61 | - @Produces(MediaType.APPLICATION_JSON) | ||
62 | - @Path("logout") | ||
63 | - public Response logout() { | ||
64 | - return Response.ok(CordModelCache.INSTANCE.jsonLogout()).build(); | ||
65 | - } | ||
66 | - | ||
67 | - // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||
68 | - | ||
69 | - @GET | ||
70 | - @Produces(MediaType.APPLICATION_JSON) | ||
71 | - @Path("bundle/{id}") | ||
72 | - public Response bundle(@PathParam("id") String bundleId) { | ||
73 | - CordModelCache.INSTANCE.setCurrentBundle(bundleId); | ||
74 | - return bundle(); | ||
75 | - } | ||
76 | - | ||
77 | - @GET | ||
78 | - @Produces(MediaType.APPLICATION_JSON) | ||
79 | - @Path("users/{id}/apply/{func}/{param}/{value}") | ||
80 | - public Response bundle(@PathParam("id") String userId, | ||
81 | - @PathParam("func") String funcId, | ||
82 | - @PathParam("param") String param, | ||
83 | - @PathParam("value") String value) { | ||
84 | - CordModelCache.INSTANCE.applyPerUserParam(userId, funcId, param, value); | ||
85 | - return users(); | ||
86 | - } | ||
87 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui; | ||
19 | - | ||
20 | -import org.apache.commons.io.IOUtils; | ||
21 | - | ||
22 | -import java.io.IOException; | ||
23 | -import java.io.InputStream; | ||
24 | - | ||
25 | -/** | ||
26 | - * Provides support for fake data. | ||
27 | - */ | ||
28 | -public class FakeUtils { | ||
29 | - private static final ClassLoader CL = FakeUtils.class.getClassLoader(); | ||
30 | - private static final String ROOT_PATH = "/org/onosproject/cord/gui/"; | ||
31 | - private static final String UTF_8 = "UTF-8"; | ||
32 | - | ||
33 | - /** | ||
34 | - * Returns the contents of a local file as a string. | ||
35 | - * | ||
36 | - * @param path file path name | ||
37 | - * @return contents of file as a string | ||
38 | - */ | ||
39 | - public static String slurp(String path) { | ||
40 | - String result = null; | ||
41 | - InputStream is = CL.getResourceAsStream(ROOT_PATH + path); | ||
42 | - if (is != null) { | ||
43 | - try { | ||
44 | - result = IOUtils.toString(is, UTF_8); | ||
45 | - } catch (IOException e) { | ||
46 | - e.printStackTrace(); | ||
47 | - } | ||
48 | - } | ||
49 | - return result; | ||
50 | - } | ||
51 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui; | ||
19 | - | ||
20 | -import com.fasterxml.jackson.databind.JsonNode; | ||
21 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
22 | -import com.fasterxml.jackson.databind.node.ArrayNode; | ||
23 | -import com.fasterxml.jackson.databind.node.ObjectNode; | ||
24 | -import org.onosproject.cord.gui.model.Bundle; | ||
25 | -import org.onosproject.cord.gui.model.SubscriberUser; | ||
26 | -import org.onosproject.cord.gui.model.XosFunction; | ||
27 | -import org.onosproject.cord.gui.model.XosFunctionDescriptor; | ||
28 | -import org.slf4j.Logger; | ||
29 | -import org.slf4j.LoggerFactory; | ||
30 | - | ||
31 | -import java.io.IOException; | ||
32 | -import java.util.Set; | ||
33 | - | ||
34 | -/** | ||
35 | - * Encapsulation of interactions with XOS. | ||
36 | - */ | ||
37 | -public class XosManager { | ||
38 | - | ||
39 | - private static final ObjectMapper MAPPER = new ObjectMapper(); | ||
40 | - | ||
41 | - private static final String HEAD_NODE_IP = "headnodeip"; | ||
42 | - private static final String HEAD_NODE_PORT = "headnodeport"; | ||
43 | - private static final int PORT_MIN = 1025; | ||
44 | - private static final int PORT_MAX = 65535; | ||
45 | - | ||
46 | - private static final String TEST_XOS_SERVER_IP = "10.254.1.22"; | ||
47 | - private static final String TEST_XOS_SERVER_PORT_STR = "8000"; | ||
48 | - private static final int TEST_XOS_SERVER_PORT = 8000; | ||
49 | - private static final String URI_RS = "/rs/"; | ||
50 | - private static final String URI_SUBSCRIBER = "/rs/subscriber/%d/"; | ||
51 | - private static final String BUNDLE_URI_FORMAT = "services/%s/%s/"; | ||
52 | - | ||
53 | - | ||
54 | - private String xosServerIp; | ||
55 | - private int xosServerPort; | ||
56 | - private XosManagerRestUtils xosUtilsRs; | ||
57 | - private XosManagerRestUtils xosUtils; | ||
58 | - | ||
59 | - | ||
60 | - private final Logger log = LoggerFactory.getLogger(getClass()); | ||
61 | - | ||
62 | - /** | ||
63 | - * No instantiation (except via unit test). | ||
64 | - */ | ||
65 | - XosManager() {} | ||
66 | - | ||
67 | - private String getXosServerIp() { | ||
68 | - return System.getProperty(HEAD_NODE_IP, TEST_XOS_SERVER_IP); | ||
69 | - } | ||
70 | - | ||
71 | - private int getXosServerPort() { | ||
72 | - String p = System.getProperty(HEAD_NODE_PORT, TEST_XOS_SERVER_PORT_STR); | ||
73 | - int port; | ||
74 | - try { | ||
75 | - port = Integer.valueOf(p); | ||
76 | - } catch (NumberFormatException e) { | ||
77 | - port = TEST_XOS_SERVER_PORT; | ||
78 | - log.warn("Could not parse port number [{}], using {}", p, port); | ||
79 | - } | ||
80 | - if (port < PORT_MIN || port > PORT_MAX) { | ||
81 | - log.warn("Bad port number [{}], using {}", port, TEST_XOS_SERVER_PORT); | ||
82 | - port = TEST_XOS_SERVER_PORT; | ||
83 | - } | ||
84 | - return port; | ||
85 | - } | ||
86 | - | ||
87 | - /** | ||
88 | - * Queries XOS for the Subscriber ID lookup data, and returns it. | ||
89 | - */ | ||
90 | - public ObjectNode initXosSubscriberLookups() { | ||
91 | - log.info("intDemoSubscriberLookups() called"); | ||
92 | - xosServerIp = getXosServerIp(); | ||
93 | - xosServerPort = getXosServerPort(); | ||
94 | - log.info("Using XOS server at {}:{}", xosServerIp, xosServerPort); | ||
95 | - | ||
96 | - xosUtilsRs = new XosManagerRestUtils(xosServerIp, xosServerPort, URI_RS); | ||
97 | - | ||
98 | - // ask XOS for the subscriber ID lookup info | ||
99 | - String result = xosUtilsRs.getRest("subidlookup/"); | ||
100 | - log.info("lookup data from XOS: {}", result); | ||
101 | - | ||
102 | - JsonNode node; | ||
103 | - try { | ||
104 | - node = MAPPER.readTree(result); | ||
105 | - } catch (IOException e) { | ||
106 | - log.error("failed to read subscriber lookup JSON data", e); | ||
107 | - return null; | ||
108 | - } | ||
109 | - return (ObjectNode) node; | ||
110 | - } | ||
111 | - | ||
112 | - /** | ||
113 | - * Sets a new XOS utils object to bind URL patterns for the | ||
114 | - * given XOS subscriber ID. | ||
115 | - * | ||
116 | - * @param xosSubId XOS subscriber ID | ||
117 | - */ | ||
118 | - public void setXosUtilsForSubscriber(int xosSubId) { | ||
119 | - String uri = String.format(URI_SUBSCRIBER, xosSubId); | ||
120 | - xosUtils = new XosManagerRestUtils(xosServerIp, xosServerPort, uri); | ||
121 | - } | ||
122 | - | ||
123 | - | ||
124 | - public void initDemoSubscriber() { | ||
125 | - log.info("initDemoSubscriber() called"); | ||
126 | - String result = xosUtilsRs.getRest("initdemo/"); | ||
127 | - log.info("initdemo data from XOS: {}", result); | ||
128 | - } | ||
129 | - | ||
130 | - /** | ||
131 | - * Returns the array of users for the subscriber. | ||
132 | - * | ||
133 | - * @return list of users | ||
134 | - */ | ||
135 | - public ArrayNode getUserList() { | ||
136 | - log.info("getUserList() called"); | ||
137 | - String result = xosUtils.getRest("users/"); | ||
138 | - | ||
139 | - JsonNode node; | ||
140 | - try { | ||
141 | - node = MAPPER.readTree(result); | ||
142 | - } catch (IOException e) { | ||
143 | - log.error("failed to read user list JSON", e); | ||
144 | - return null; | ||
145 | - } | ||
146 | - | ||
147 | - ObjectNode obj = (ObjectNode) node; | ||
148 | - return (ArrayNode) obj.get("users"); | ||
149 | - } | ||
150 | - | ||
151 | - | ||
152 | - /** | ||
153 | - * Configure XOS to enable the functions that compose the given bundle, | ||
154 | - * and disable all the others, for the given subscriber. | ||
155 | - * | ||
156 | - * @param bundle new bundle to set | ||
157 | - */ | ||
158 | - public void setNewBundle(Bundle bundle) { | ||
159 | - log.info(">> Set New Bundle : {}", bundle.descriptor().id()); | ||
160 | - | ||
161 | - Set<XosFunctionDescriptor> inBundle = bundle.descriptor().functions(); | ||
162 | - for (XosFunctionDescriptor xfd: XosFunctionDescriptor.values()) { | ||
163 | - // only process the functions that have a real back-end on XOS | ||
164 | - if (xfd.backend()) { | ||
165 | - String uri = String.format(BUNDLE_URI_FORMAT, xfd.id(), | ||
166 | - inBundle.contains(xfd)); | ||
167 | - log.info("XOS-URI: {}", uri); | ||
168 | - String result = xosUtils.putRest(uri); | ||
169 | - // TODO: convert JSON result to object and check (if we care) | ||
170 | - } | ||
171 | - } | ||
172 | - } | ||
173 | - | ||
174 | - /** | ||
175 | - * Configure XOS with new setting for given user and function, for the | ||
176 | - * given subscriber account. | ||
177 | - * | ||
178 | - * @param func specific XOS function | ||
179 | - * @param user user (containing function state) | ||
180 | - */ | ||
181 | - public void apply(XosFunction func, SubscriberUser user) { | ||
182 | - log.info(">> Apply : {} for {}", func, user); | ||
183 | - | ||
184 | - String uriPrefix = "users/" + user.id() + "/"; | ||
185 | - String uri = uriPrefix + func.xosUrlApply(user); | ||
186 | - log.info("XOS-URI: {}", uri); | ||
187 | - String result = xosUtils.putRest(uri); | ||
188 | - // TODO: convert JSON result to object and check (if we care) | ||
189 | - } | ||
190 | - | ||
191 | - | ||
192 | - // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||
193 | - | ||
194 | - /** | ||
195 | - * Singleton instance. | ||
196 | - */ | ||
197 | - public static final XosManager INSTANCE = new XosManager(); | ||
198 | -} |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/XosManagerRestUtils.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui; | ||
19 | - | ||
20 | -import com.sun.jersey.api.client.Client; | ||
21 | -import com.sun.jersey.api.client.ClientHandlerException; | ||
22 | -import com.sun.jersey.api.client.ClientResponse; | ||
23 | -import com.sun.jersey.api.client.WebResource; | ||
24 | -import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; | ||
25 | -import org.slf4j.Logger; | ||
26 | - | ||
27 | -import static com.google.common.net.MediaType.JSON_UTF_8; | ||
28 | -import static java.net.HttpURLConnection.*; | ||
29 | -import static org.slf4j.LoggerFactory.getLogger; | ||
30 | - | ||
31 | -/** | ||
32 | - * Utility RESTful methods for dealing with the XOS server. | ||
33 | - */ | ||
34 | -public class XosManagerRestUtils { | ||
35 | - private static final String XOSLIB = "/xoslib"; | ||
36 | - private static final String AUTH_USER = "padmin@vicci.org"; | ||
37 | - private static final String AUTH_PASS = "letmein"; | ||
38 | - | ||
39 | - private static final String UTF_8 = JSON_UTF_8.toString(); | ||
40 | - | ||
41 | - private final Logger log = getLogger(getClass()); | ||
42 | - | ||
43 | - private final String xosServerAddress; | ||
44 | - private final int xosServerPort; | ||
45 | - private final String baseUri; | ||
46 | - | ||
47 | - | ||
48 | - /** | ||
49 | - * Constructs a utility class, using the supplied server address and port, | ||
50 | - * using the given base URI. | ||
51 | - * <p> | ||
52 | - * Note that the uri should start and end with a slash; for example: | ||
53 | - * {@code "/volttenant/"}. This example would result in URIs of the form: | ||
54 | - * <pre> | ||
55 | - * "http://[server]:[port]/xoslib/volttenant/" | ||
56 | - * </pre> | ||
57 | - * | ||
58 | - * @param xosServerAddress server IP address | ||
59 | - * @param xosServerPort server port | ||
60 | - * @param baseUri base URI | ||
61 | - */ | ||
62 | - public XosManagerRestUtils(String xosServerAddress, int xosServerPort, | ||
63 | - String baseUri) { | ||
64 | - this.xosServerAddress = xosServerAddress; | ||
65 | - this.xosServerPort = xosServerPort; | ||
66 | - this.baseUri = baseUri; | ||
67 | - log.info("XMRU:: {}:{}{}", xosServerAddress, xosServerPort, baseUri); | ||
68 | - } | ||
69 | - | ||
70 | - // build the base URL from the pieces we know... | ||
71 | - private String baseUrl() { | ||
72 | - return "http://" + xosServerAddress + ":" + | ||
73 | - Integer.toString(xosServerPort) + XOSLIB + baseUri; | ||
74 | - } | ||
75 | - | ||
76 | - /** | ||
77 | - * Gets a client web resource builder for the base XOS REST API | ||
78 | - * with no additional URI. | ||
79 | - * | ||
80 | - * @return web resource builder | ||
81 | - */ | ||
82 | - public WebResource.Builder getClientBuilder() { | ||
83 | - return getClientBuilder(""); | ||
84 | - } | ||
85 | - | ||
86 | - /** | ||
87 | - * Gets a client web resource builder for the base XOS REST API | ||
88 | - * with an optional additional URI. | ||
89 | - * | ||
90 | - * @param uri URI suffix to append to base URI | ||
91 | - * @return web resource builder | ||
92 | - */ | ||
93 | - public WebResource.Builder getClientBuilder(String uri) { | ||
94 | - Client client = Client.create(); | ||
95 | - client.addFilter(new HTTPBasicAuthFilter(AUTH_USER, AUTH_PASS)); | ||
96 | - WebResource resource = client.resource(baseUrl() + uri); | ||
97 | - log.info("XOS REST CALL>> {}", resource); | ||
98 | - return resource.accept(UTF_8).type(UTF_8); | ||
99 | - } | ||
100 | - | ||
101 | - /** | ||
102 | - * Performs a REST GET operation on the base XOS REST URI. | ||
103 | - * | ||
104 | - * @return JSON string fetched by the GET operation | ||
105 | - */ | ||
106 | - public String getRest() { | ||
107 | - return getRest(""); | ||
108 | - } | ||
109 | - | ||
110 | - /** | ||
111 | - * Performs a REST GET operation on the base XOS REST URI with | ||
112 | - * an optional additional URI. | ||
113 | - * | ||
114 | - * @param uri URI suffix to append to base URI | ||
115 | - * @return JSON string fetched by the GET operation | ||
116 | - */ | ||
117 | - public String getRest(String uri) { | ||
118 | - WebResource.Builder builder = getClientBuilder(uri); | ||
119 | - ClientResponse response = builder.get(ClientResponse.class); | ||
120 | - | ||
121 | - if (response.getStatus() != HTTP_OK) { | ||
122 | - log.info("REST GET request returned error code {}", | ||
123 | - response.getStatus()); | ||
124 | - } | ||
125 | - return response.getEntity(String.class); | ||
126 | - } | ||
127 | - | ||
128 | - /** | ||
129 | - * Performs a REST PUT operation on the base XOS REST URI. | ||
130 | - * | ||
131 | - * @return JSON string returned by the PUT operation | ||
132 | - */ | ||
133 | - public String putRest() { | ||
134 | - return putRest(""); | ||
135 | - } | ||
136 | - | ||
137 | - /** | ||
138 | - * Performs a REST PUT operation on the base XOS REST URI with | ||
139 | - * an optional additional URI. | ||
140 | - * | ||
141 | - * @param uri URI suffix to append to base URI | ||
142 | - * @return JSON string returned by the PUT operation | ||
143 | - */ | ||
144 | - public String putRest(String uri) { | ||
145 | - WebResource.Builder builder = getClientBuilder(uri); | ||
146 | - ClientResponse response; | ||
147 | - | ||
148 | - try { | ||
149 | - response = builder.put(ClientResponse.class); | ||
150 | - } catch (ClientHandlerException e) { | ||
151 | - log.warn("Unable to contact REST server: {}", e.getMessage()); | ||
152 | - return ""; | ||
153 | - } | ||
154 | - | ||
155 | - if (response.getStatus() != HTTP_OK) { | ||
156 | - log.info("REST PUT request returned error code {}", | ||
157 | - response.getStatus()); | ||
158 | - } | ||
159 | - return response.getEntity(String.class); | ||
160 | - } | ||
161 | - | ||
162 | - /** | ||
163 | - * Performs a REST POST operation of a json string on the base | ||
164 | - * XOS REST URI with an optional additional URI. | ||
165 | - * | ||
166 | - * @param json JSON string to post | ||
167 | - */ | ||
168 | - public void postRest(String json) { | ||
169 | - postRest("", json); | ||
170 | - } | ||
171 | - | ||
172 | - /** | ||
173 | - * Performs a REST POST operation of a json string on the base | ||
174 | - * XOS REST URI with an optional additional URI suffix. | ||
175 | - * | ||
176 | - * @param uri URI suffix to append to base URI | ||
177 | - * @param json JSON string to post | ||
178 | - */ | ||
179 | - public void postRest(String uri, String json) { | ||
180 | - WebResource.Builder builder = getClientBuilder(uri); | ||
181 | - ClientResponse response; | ||
182 | - | ||
183 | - try { | ||
184 | - response = builder.post(ClientResponse.class, json); | ||
185 | - } catch (ClientHandlerException e) { | ||
186 | - log.warn("Unable to contact REST server: {}", e.getMessage()); | ||
187 | - return; | ||
188 | - } | ||
189 | - | ||
190 | - if (response.getStatus() != HTTP_CREATED) { | ||
191 | - log.info("REST POST request returned error code {}", | ||
192 | - response.getStatus()); | ||
193 | - } | ||
194 | - } | ||
195 | - | ||
196 | - /** | ||
197 | - * Performs a REST DELETE operation on the base | ||
198 | - * XOS REST URI with an optional additional URI. | ||
199 | - * | ||
200 | - * @param uri URI suffix to append to base URI | ||
201 | - */ | ||
202 | - public void deleteRest(String uri) { | ||
203 | - WebResource.Builder builder = getClientBuilder(uri); | ||
204 | - ClientResponse response = builder.delete(ClientResponse.class); | ||
205 | - | ||
206 | - if (response.getStatus() != HTTP_NO_CONTENT) { | ||
207 | - log.info("REST DELETE request returned error code {}", | ||
208 | - response.getStatus()); | ||
209 | - } | ||
210 | - } | ||
211 | - | ||
212 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import com.google.common.collect.ImmutableSet; | ||
21 | - | ||
22 | -import java.util.HashMap; | ||
23 | -import java.util.Map; | ||
24 | -import java.util.Set; | ||
25 | - | ||
26 | -/** | ||
27 | - * Encapsulates a bundle, including current state. | ||
28 | - */ | ||
29 | -public class Bundle { | ||
30 | - private final BundleDescriptor bundleDescriptor; | ||
31 | - private final Map<XosFunctionDescriptor, XosFunction> functionMap = | ||
32 | - new HashMap<XosFunctionDescriptor, XosFunction>(); | ||
33 | - | ||
34 | - /** | ||
35 | - * Constructs a new bundle instance. | ||
36 | - * | ||
37 | - * @param bundleDescriptor the descriptor | ||
38 | - */ | ||
39 | - public Bundle(BundleDescriptor bundleDescriptor) { | ||
40 | - this.bundleDescriptor = bundleDescriptor; | ||
41 | - initFunctions(); | ||
42 | - } | ||
43 | - | ||
44 | - /** | ||
45 | - * Returns the bundle descriptor. | ||
46 | - * | ||
47 | - * @return the descriptor | ||
48 | - */ | ||
49 | - public BundleDescriptor descriptor() { | ||
50 | - return bundleDescriptor; | ||
51 | - } | ||
52 | - | ||
53 | - /** | ||
54 | - * Returns the set of function instances for this bundle. | ||
55 | - * | ||
56 | - * @return the functions | ||
57 | - */ | ||
58 | - public Set<XosFunction> functions() { | ||
59 | - return ImmutableSet.copyOf(functionMap.values()); | ||
60 | - } | ||
61 | - | ||
62 | - /** | ||
63 | - * Creates an initial set of function instances. | ||
64 | - */ | ||
65 | - private void initFunctions() { | ||
66 | - for (XosFunctionDescriptor xfd: bundleDescriptor.functions()) { | ||
67 | - functionMap.put(xfd, createFunction(xfd)); | ||
68 | - } | ||
69 | - } | ||
70 | - | ||
71 | - private XosFunction createFunction(XosFunctionDescriptor xfd) { | ||
72 | - XosFunction func; | ||
73 | - switch (xfd) { | ||
74 | - case URL_FILTER: | ||
75 | - func = new UrlFilterFunction(); | ||
76 | - break; | ||
77 | - | ||
78 | - default: | ||
79 | - func = new DefaultXosFunction(xfd); | ||
80 | - break; | ||
81 | - } | ||
82 | - return func; | ||
83 | - } | ||
84 | - | ||
85 | - /** | ||
86 | - * Returns the function instance for the specified descriptor, or returns | ||
87 | - * null if function is not part of this bundle. | ||
88 | - * | ||
89 | - * @param xfd function descrriptor | ||
90 | - * @return function instance | ||
91 | - */ | ||
92 | - public XosFunction findFunction(XosFunctionDescriptor xfd) { | ||
93 | - return functionMap.get(xfd); | ||
94 | - } | ||
95 | -} |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/BundleDescriptor.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import java.util.Set; | ||
21 | - | ||
22 | -/** | ||
23 | - * Defines a bundle of {@link XosFunctionDescriptor XOS functions}. | ||
24 | - */ | ||
25 | -public interface BundleDescriptor { | ||
26 | - | ||
27 | - /** | ||
28 | - * Bundle internal identifier. | ||
29 | - * | ||
30 | - * @return bundle identifier | ||
31 | - */ | ||
32 | - String id(); | ||
33 | - | ||
34 | - /** | ||
35 | - * Bundle display name. | ||
36 | - * | ||
37 | - * @return display name | ||
38 | - */ | ||
39 | - String displayName(); | ||
40 | - | ||
41 | - /** | ||
42 | - * Textual description of this bundle. | ||
43 | - * | ||
44 | - * @return description | ||
45 | - */ | ||
46 | - String description(); | ||
47 | - | ||
48 | - /** | ||
49 | - * The set of functions in this bundle instance. | ||
50 | - * | ||
51 | - * @return the functions | ||
52 | - */ | ||
53 | - Set<XosFunctionDescriptor> functions(); | ||
54 | -} |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/BundleFactory.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import com.fasterxml.jackson.databind.node.ArrayNode; | ||
21 | -import com.fasterxml.jackson.databind.node.ObjectNode; | ||
22 | -import com.google.common.collect.ImmutableList; | ||
23 | - | ||
24 | -import java.util.List; | ||
25 | - | ||
26 | -/** | ||
27 | - * Utility factory for creating and/or operating on bundles. | ||
28 | - */ | ||
29 | -public class BundleFactory extends JsonFactory { | ||
30 | - | ||
31 | - private static final String BUNDLE = "bundle"; | ||
32 | - private static final String BUNDLES = "bundles"; | ||
33 | - private static final String FUNCTIONS = "functions"; | ||
34 | - | ||
35 | - private static final String BASIC_ID = "basic"; | ||
36 | - private static final String BASIC_DISPLAY_NAME = "Basic Bundle"; | ||
37 | - private static final String BASIC_DESCRIPTION = | ||
38 | - "If the thing that matters most to you is high speed Internet" + | ||
39 | - " connectivity delivered at a great price, then the basic" + | ||
40 | - " bundle is right for you.\n" + | ||
41 | - "Starting at $30 a month for 12 months."; | ||
42 | - | ||
43 | - private static final String FAMILY_ID = "family"; | ||
44 | - private static final String FAMILY_DISPLAY_NAME = "Family Bundle"; | ||
45 | - private static final String FAMILY_DESCRIPTION = | ||
46 | - "Enjoy great entertainment, peace of mind and big savings when " + | ||
47 | - "you bundle high speed Internet and Firewall with" + | ||
48 | - " Parental Control.\n" + | ||
49 | - "Starting at $40 a month for 12 months."; | ||
50 | - | ||
51 | - | ||
52 | - // no instantiation | ||
53 | - private BundleFactory() {} | ||
54 | - | ||
55 | - /** | ||
56 | - * Designates the BASIC bundle. | ||
57 | - */ | ||
58 | - public static final BundleDescriptor BASIC_BUNDLE = | ||
59 | - new DefaultBundleDescriptor(BASIC_ID, BASIC_DISPLAY_NAME, | ||
60 | - BASIC_DESCRIPTION, | ||
61 | - XosFunctionDescriptor.INTERNET, | ||
62 | - XosFunctionDescriptor.FIREWALL, | ||
63 | - XosFunctionDescriptor.CDN); | ||
64 | - | ||
65 | - /** | ||
66 | - * Designates the FAMILY bundle. | ||
67 | - */ | ||
68 | - public static final BundleDescriptor FAMILY_BUNDLE = | ||
69 | - new DefaultBundleDescriptor(FAMILY_ID, FAMILY_DISPLAY_NAME, | ||
70 | - FAMILY_DESCRIPTION, | ||
71 | - XosFunctionDescriptor.INTERNET, | ||
72 | - XosFunctionDescriptor.FIREWALL, | ||
73 | - XosFunctionDescriptor.CDN, | ||
74 | - XosFunctionDescriptor.URL_FILTER); | ||
75 | - | ||
76 | - // all bundles, in the order they should be listed in the GUI | ||
77 | - private static final List<BundleDescriptor> ALL_BUNDLES = ImmutableList.of( | ||
78 | - BASIC_BUNDLE, | ||
79 | - FAMILY_BUNDLE | ||
80 | - ); | ||
81 | - | ||
82 | - /** | ||
83 | - * Returns the list of available bundles. | ||
84 | - * | ||
85 | - * @return available bundles | ||
86 | - */ | ||
87 | - public static List<BundleDescriptor> availableBundles() { | ||
88 | - return ALL_BUNDLES; | ||
89 | - } | ||
90 | - | ||
91 | - /** | ||
92 | - * Returns the bundle descriptor for the given identifier. | ||
93 | - * | ||
94 | - * @param bundleId bundle identifier | ||
95 | - * @return bundle descriptor | ||
96 | - * @throws IllegalArgumentException if bundle ID is unknown | ||
97 | - */ | ||
98 | - public static BundleDescriptor bundleFromId(String bundleId) { | ||
99 | - for (BundleDescriptor bd : ALL_BUNDLES) { | ||
100 | - if (bd.id().equals(bundleId)) { | ||
101 | - return bd; | ||
102 | - } | ||
103 | - } | ||
104 | - throw new IllegalArgumentException("unknown bundle: " + bundleId); | ||
105 | - } | ||
106 | - | ||
107 | - /** | ||
108 | - * Returns an object node representation of the given bundle. | ||
109 | - * Note that some functions (such as CDN) are not added to the output | ||
110 | - * as we don't want them to appear in the GUI. | ||
111 | - * | ||
112 | - * @param bundle the bundle | ||
113 | - * @return object node | ||
114 | - */ | ||
115 | - public static ObjectNode toObjectNode(Bundle bundle) { | ||
116 | - ObjectNode root = objectNode(); | ||
117 | - BundleDescriptor descriptor = bundle.descriptor(); | ||
118 | - | ||
119 | - ObjectNode bnode = objectNode() | ||
120 | - .put(ID, descriptor.id()) | ||
121 | - .put(NAME, descriptor.displayName()) | ||
122 | - .put(DESC, descriptor.description()); | ||
123 | - | ||
124 | - ArrayNode funcs = arrayNode(); | ||
125 | - for (XosFunctionDescriptor xfd: bundle.descriptor().functions()) { | ||
126 | - if (xfd.visible()) { | ||
127 | - funcs.add(XosFunctionFactory.toObjectNode(xfd)); | ||
128 | - } | ||
129 | - } | ||
130 | - bnode.set(FUNCTIONS, funcs); | ||
131 | - root.set(BUNDLE, bnode); | ||
132 | - | ||
133 | - ArrayNode bundles = arrayNode(); | ||
134 | - for (BundleDescriptor bd: BundleFactory.availableBundles()) { | ||
135 | - ObjectNode bdnode = objectNode() | ||
136 | - .put(ID, bd.id()) | ||
137 | - .put(NAME, bd.displayName()) | ||
138 | - .put(DESC, bd.description()); | ||
139 | - bundles.add(bdnode); | ||
140 | - } | ||
141 | - root.set(BUNDLES, bundles); | ||
142 | - return root; | ||
143 | - } | ||
144 | -} |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/DefaultBundleDescriptor.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import com.google.common.collect.ImmutableSet; | ||
21 | - | ||
22 | -import java.util.Set; | ||
23 | - | ||
24 | - | ||
25 | -/** | ||
26 | - * Base implementation of BundleDescriptor. | ||
27 | - */ | ||
28 | -public class DefaultBundleDescriptor implements BundleDescriptor { | ||
29 | - | ||
30 | - private final String id; | ||
31 | - private final String displayName; | ||
32 | - private final String description; | ||
33 | - private final Set<XosFunctionDescriptor> functions; | ||
34 | - | ||
35 | - /** | ||
36 | - * Constructs a bundle descriptor. | ||
37 | - * | ||
38 | - * @param id bundle identifier | ||
39 | - * @param displayName bundle display name | ||
40 | - * @param functions functions that make up this bundle | ||
41 | - */ | ||
42 | - DefaultBundleDescriptor(String id, String displayName, String description, | ||
43 | - XosFunctionDescriptor... functions) { | ||
44 | - this.id = id; | ||
45 | - this.displayName = displayName; | ||
46 | - this.description = description; | ||
47 | - this.functions = ImmutableSet.copyOf(functions); | ||
48 | - } | ||
49 | - | ||
50 | - | ||
51 | - public String id() { | ||
52 | - return id; | ||
53 | - } | ||
54 | - | ||
55 | - public String displayName() { | ||
56 | - return displayName; | ||
57 | - } | ||
58 | - | ||
59 | - public String description() { | ||
60 | - return description; | ||
61 | - } | ||
62 | - | ||
63 | - public Set<XosFunctionDescriptor> functions() { | ||
64 | - return functions; | ||
65 | - } | ||
66 | - | ||
67 | - @Override | ||
68 | - public String toString() { | ||
69 | - return "{BundleDescriptor: " + displayName + "}"; | ||
70 | - } | ||
71 | - | ||
72 | - @Override | ||
73 | - public boolean equals(Object o) { | ||
74 | - if (this == o) { | ||
75 | - return true; | ||
76 | - } | ||
77 | - if (o == null || getClass() != o.getClass()) { | ||
78 | - return false; | ||
79 | - } | ||
80 | - | ||
81 | - DefaultBundleDescriptor that = (DefaultBundleDescriptor) o; | ||
82 | - return id.equals(that.id); | ||
83 | - } | ||
84 | - | ||
85 | - @Override | ||
86 | - public int hashCode() { | ||
87 | - return id.hashCode(); | ||
88 | - } | ||
89 | -} |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/DefaultXosFunction.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
21 | - | ||
22 | -/** | ||
23 | - * Default XOS function implementation, that does not have any parameters | ||
24 | - * to tweak. | ||
25 | - */ | ||
26 | -public class DefaultXosFunction implements XosFunction { | ||
27 | - | ||
28 | - protected static final ObjectMapper MAPPER = new ObjectMapper(); | ||
29 | - | ||
30 | - private final XosFunctionDescriptor xfd; | ||
31 | - | ||
32 | - public DefaultXosFunction(XosFunctionDescriptor xfd) { | ||
33 | - this.xfd = xfd; | ||
34 | - } | ||
35 | - | ||
36 | - public XosFunctionDescriptor descriptor() { | ||
37 | - return xfd; | ||
38 | - } | ||
39 | - | ||
40 | - /** | ||
41 | - * {@inheritDoc} | ||
42 | - * <p> | ||
43 | - * This default implementation throws an exception. | ||
44 | - * | ||
45 | - * @param user user to apply the change to | ||
46 | - * @param param parameter name | ||
47 | - * @param value new parameter value | ||
48 | - * @throws UnsupportedOperationException if invoked | ||
49 | - */ | ||
50 | - public void applyParam(SubscriberUser user, String param, String value) { | ||
51 | - throw new UnsupportedOperationException(); | ||
52 | - } | ||
53 | - | ||
54 | - public Memento createMemento() { | ||
55 | - return null; | ||
56 | - } | ||
57 | - | ||
58 | - public String xosUrlApply(SubscriberUser user) { | ||
59 | - return null; | ||
60 | - } | ||
61 | - | ||
62 | - @Override | ||
63 | - public String toString() { | ||
64 | - return "{XosFunction: " + xfd + "}"; | ||
65 | - } | ||
66 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
21 | -import com.fasterxml.jackson.databind.node.ArrayNode; | ||
22 | -import com.fasterxml.jackson.databind.node.ObjectNode; | ||
23 | - | ||
24 | -/** | ||
25 | - * Base class for factories that convert objects to JSON. | ||
26 | - */ | ||
27 | -public abstract class JsonFactory { | ||
28 | - | ||
29 | - private static final ObjectMapper MAPPER = new ObjectMapper(); | ||
30 | - | ||
31 | - protected static final String ID = "id"; | ||
32 | - protected static final String NAME = "name"; | ||
33 | - protected static final String DESC = "desc"; | ||
34 | - protected static final String ICON_ID = "icon_id"; | ||
35 | - | ||
36 | - /** | ||
37 | - * Returns a freshly minted object node. | ||
38 | - * | ||
39 | - * @return empty object node | ||
40 | - */ | ||
41 | - protected static ObjectNode objectNode() { | ||
42 | - return MAPPER.createObjectNode(); | ||
43 | - } | ||
44 | - | ||
45 | - /** | ||
46 | - * Returns a freshly minted array node. | ||
47 | - * | ||
48 | - * @return empty array node | ||
49 | - */ | ||
50 | - protected static ArrayNode arrayNode() { | ||
51 | - return MAPPER.createArrayNode(); | ||
52 | - } | ||
53 | -} |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/SubscriberUser.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import java.util.HashMap; | ||
21 | -import java.util.Map; | ||
22 | - | ||
23 | -/** | ||
24 | - * Designates a user of a subscriber's account. | ||
25 | - */ | ||
26 | -public class SubscriberUser { | ||
27 | - private final int id; | ||
28 | - private final String name; | ||
29 | - private final String mac; | ||
30 | - | ||
31 | - // this is "duplicated" in the URL_FILTER memento, but, oh well... | ||
32 | - // -- the level, as returned from XOS, when we create this user object. | ||
33 | - private String level; | ||
34 | - | ||
35 | - private final Map<XosFunctionDescriptor, XosFunction.Memento> mementos = | ||
36 | - new HashMap<XosFunctionDescriptor, XosFunction.Memento>(); | ||
37 | - | ||
38 | - /** | ||
39 | - * Constructs a subscriber user from the given parameters. | ||
40 | - * | ||
41 | - * @param id internal identifier | ||
42 | - * @param name display name | ||
43 | - * @param mac MAC address of the associated device | ||
44 | - * @param level URL filter level | ||
45 | - */ | ||
46 | - public SubscriberUser(int id, String name, String mac, String level) { | ||
47 | - this.id = id; | ||
48 | - this.name = name; | ||
49 | - this.mac = mac; | ||
50 | - this.level = level; | ||
51 | - } | ||
52 | - | ||
53 | - /** | ||
54 | - * Returns the internal identifier. | ||
55 | - * | ||
56 | - * @return the identifier | ||
57 | - */ | ||
58 | - public int id() { | ||
59 | - return id; | ||
60 | - } | ||
61 | - | ||
62 | - /** | ||
63 | - * Returns the display name. | ||
64 | - * | ||
65 | - * @return display name | ||
66 | - */ | ||
67 | - public String name() { | ||
68 | - return name; | ||
69 | - } | ||
70 | - | ||
71 | - /** | ||
72 | - * Returns the MAC address of the associated device. | ||
73 | - * | ||
74 | - * @return MAC address | ||
75 | - */ | ||
76 | - public String mac() { | ||
77 | - return mac; | ||
78 | - } | ||
79 | - | ||
80 | - /** | ||
81 | - * Returns the URL filter level. | ||
82 | - * | ||
83 | - * @return URL filter level | ||
84 | - */ | ||
85 | - public String urlFilterLevel() { | ||
86 | - return level; | ||
87 | - } | ||
88 | - | ||
89 | - /** | ||
90 | - * Sets the URL filter level. | ||
91 | - * | ||
92 | - * @param level URL filter level | ||
93 | - */ | ||
94 | - public void setUrlFilterLevel(String level) { | ||
95 | - this.level = level; | ||
96 | - } | ||
97 | - | ||
98 | - /** | ||
99 | - * Stores a memento for the given XOS function. | ||
100 | - * | ||
101 | - * @param f XOS function | ||
102 | - * @param m memento | ||
103 | - */ | ||
104 | - public void setMemento(XosFunctionDescriptor f, XosFunction.Memento m) { | ||
105 | - if (m != null) { | ||
106 | - mementos.put(f, m); | ||
107 | - } | ||
108 | - } | ||
109 | - | ||
110 | - /** | ||
111 | - * Returns the memento stored on this user, for the given XOS function. | ||
112 | - * | ||
113 | - * @param f XOS function | ||
114 | - * @return memento | ||
115 | - */ | ||
116 | - public XosFunction.Memento getMemento(XosFunctionDescriptor f) { | ||
117 | - return mementos.get(f); | ||
118 | - } | ||
119 | - | ||
120 | - /** | ||
121 | - * Clears the memento map. | ||
122 | - */ | ||
123 | - public void clearMementos() { | ||
124 | - mementos.clear(); | ||
125 | - } | ||
126 | - | ||
127 | - @Override | ||
128 | - public String toString() { | ||
129 | - return "{User: " + name + "}"; | ||
130 | - } | ||
131 | -} |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/UrlFilterFunction.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import com.fasterxml.jackson.databind.node.ObjectNode; | ||
21 | - | ||
22 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
23 | - | ||
24 | -/** | ||
25 | - * Specialization of XosFunction for URL filtering. | ||
26 | - */ | ||
27 | -public class UrlFilterFunction extends DefaultXosFunction { | ||
28 | - | ||
29 | - private static final String LEVEL = "level"; | ||
30 | - private static final String URI_PATTERN = "%s/%s/"; | ||
31 | - | ||
32 | - /** | ||
33 | - * Denotes the URL filtering levels available. From most restrictive | ||
34 | - * to least restrictive. Note: <em>NONE</em> allows nothing; | ||
35 | - * <em>ALL</em> allows everything. | ||
36 | - */ | ||
37 | - public enum Level { NONE, G, PG, PG_13, R, ALL } | ||
38 | - | ||
39 | - /** | ||
40 | - * The default URL filtering level | ||
41 | - */ | ||
42 | - public static final Level DEFAULT_LEVEL = Level.G; | ||
43 | - | ||
44 | - public UrlFilterFunction() { | ||
45 | - super(XosFunctionDescriptor.URL_FILTER); | ||
46 | - } | ||
47 | - | ||
48 | - @Override | ||
49 | - public void applyParam(SubscriberUser user, String param, String value) { | ||
50 | - Memento memo = user.getMemento(descriptor()); | ||
51 | - checkNotNull(memo, "missing memento for " + descriptor()); | ||
52 | - UrlFilterMemento ufMemo = (UrlFilterMemento) memo; | ||
53 | - | ||
54 | - if (LEVEL.equals(param)) { | ||
55 | - Level newLevel = Level.valueOf(value.toUpperCase()); | ||
56 | - ufMemo.setLevel(newLevel); | ||
57 | - | ||
58 | - // Also store the (string version) of the level | ||
59 | - // (not in the memento). Hackish, but that's how it is for now. | ||
60 | - user.setUrlFilterLevel(value); | ||
61 | - } | ||
62 | - } | ||
63 | - | ||
64 | - @Override | ||
65 | - public Memento createMemento() { | ||
66 | - return new UrlFilterMemento(); | ||
67 | - } | ||
68 | - | ||
69 | - class UrlFilterMemento implements Memento { | ||
70 | - private Level level = DEFAULT_LEVEL; | ||
71 | - | ||
72 | - public ObjectNode toObjectNode() { | ||
73 | - ObjectNode node = MAPPER.createObjectNode(); | ||
74 | - node.put(LEVEL, level.name()); | ||
75 | - return node; | ||
76 | - } | ||
77 | - | ||
78 | - public void setLevel(Level level) { | ||
79 | - this.level = level; | ||
80 | - } | ||
81 | - | ||
82 | - public String level() { | ||
83 | - return level.toString(); | ||
84 | - } | ||
85 | - } | ||
86 | - | ||
87 | - @Override | ||
88 | - public String xosUrlApply(SubscriberUser user) { | ||
89 | - XosFunctionDescriptor xfd = XosFunctionDescriptor.URL_FILTER; | ||
90 | - UrlFilterMemento memo = (UrlFilterMemento) user.getMemento(xfd); | ||
91 | - return String.format(URI_PATTERN, xfd.id(), memo.level()); | ||
92 | - } | ||
93 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import com.fasterxml.jackson.databind.node.ObjectNode; | ||
21 | - | ||
22 | -import java.util.HashMap; | ||
23 | -import java.util.Map; | ||
24 | - | ||
25 | -/** | ||
26 | - * Utility functions on users. | ||
27 | - */ | ||
28 | -public class UserFactory extends JsonFactory { | ||
29 | - | ||
30 | - private static final String MAC = "mac"; | ||
31 | - private static final String PROFILE = "profile"; | ||
32 | - | ||
33 | - | ||
34 | - // hard-coded icons for the demo | ||
35 | - private static final Map<String, String> ICON_LOOKUP = | ||
36 | - new HashMap<String, String>(); | ||
37 | - static { | ||
38 | - ICON_LOOKUP.put("Mom's PC", "mom"); | ||
39 | - ICON_LOOKUP.put("Dad's PC", "dad"); | ||
40 | - ICON_LOOKUP.put("Jack's Laptop", "boy2"); | ||
41 | - ICON_LOOKUP.put("Jill's Laptop", "girl1"); | ||
42 | - } | ||
43 | - | ||
44 | - private static final String DEFAULT_ICON_ID = "boy1"; | ||
45 | - | ||
46 | - // no instantiation | ||
47 | - private UserFactory() {} | ||
48 | - | ||
49 | - /** | ||
50 | - * Returns an object node representation of the given user. | ||
51 | - * | ||
52 | - * @param user the user | ||
53 | - * @return object node | ||
54 | - */ | ||
55 | - public static ObjectNode toObjectNode(SubscriberUser user) { | ||
56 | - String icon = ICON_LOOKUP.get(user.name()); | ||
57 | - icon = icon == null ? DEFAULT_ICON_ID : icon; | ||
58 | - | ||
59 | - ObjectNode root = objectNode() | ||
60 | - .put(ID, user.id()) | ||
61 | - .put(ICON_ID, icon) | ||
62 | - .put(NAME, user.name()) | ||
63 | - .put(MAC, user.mac()); | ||
64 | - root.set(PROFILE, XosFunctionFactory.profileForUser(user)); | ||
65 | - return root; | ||
66 | - } | ||
67 | - | ||
68 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | - | ||
21 | -import com.fasterxml.jackson.databind.node.ObjectNode; | ||
22 | - | ||
23 | -/** | ||
24 | - * Designates a specific instance of an XOS function. | ||
25 | - */ | ||
26 | -public interface XosFunction { | ||
27 | - | ||
28 | - /** | ||
29 | - * Returns the descriptor for this function. | ||
30 | - * | ||
31 | - * @return function descriptor | ||
32 | - */ | ||
33 | - XosFunctionDescriptor descriptor(); | ||
34 | - | ||
35 | - /** | ||
36 | - * Applies a parameter change for the given user. | ||
37 | - * | ||
38 | - * @param user user to apply change to | ||
39 | - * @param param parameter name | ||
40 | - * @param value new parameter value | ||
41 | - */ | ||
42 | - void applyParam(SubscriberUser user, String param, String value); | ||
43 | - | ||
44 | - /** | ||
45 | - * Create an initialized memento. | ||
46 | - * If the function maintains no state per user, return null. | ||
47 | - * | ||
48 | - * @return a new memento | ||
49 | - */ | ||
50 | - Memento createMemento(); | ||
51 | - | ||
52 | - /** | ||
53 | - * Create the XOS specific URL suffix for applying state change for | ||
54 | - * the given user. | ||
55 | - * | ||
56 | - * @param user the user | ||
57 | - * @return URL suffix | ||
58 | - */ | ||
59 | - String xosUrlApply(SubscriberUser user); | ||
60 | - | ||
61 | - /** | ||
62 | - * Internal state memento. | ||
63 | - */ | ||
64 | - interface Memento { | ||
65 | - /** | ||
66 | - * Returns a JSON representation of this memento. | ||
67 | - * | ||
68 | - * @return memento state as object node | ||
69 | - */ | ||
70 | - ObjectNode toObjectNode(); | ||
71 | - } | ||
72 | -} | ||
73 | - |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/XosFunctionDescriptor.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -/** | ||
21 | - * Designates XOS Functions. | ||
22 | - */ | ||
23 | -public enum XosFunctionDescriptor { | ||
24 | - /** | ||
25 | - * Internet function. | ||
26 | - */ | ||
27 | - INTERNET("internet", | ||
28 | - "Internet", | ||
29 | - "Discover the joys of high-speed, reliable Internet" + | ||
30 | - " connectivity delivered seamlessly to your home.", | ||
31 | - false, | ||
32 | - true), | ||
33 | - | ||
34 | - /** | ||
35 | - * Firewall function. | ||
36 | - */ | ||
37 | - FIREWALL("firewall", | ||
38 | - "Firewall", | ||
39 | - "Simple access control and filtering with minimal set-up.", | ||
40 | - true, | ||
41 | - true), | ||
42 | - | ||
43 | - /** | ||
44 | - * URL Filtering function (parental controls). | ||
45 | - */ | ||
46 | - URL_FILTER("url_filter", | ||
47 | - "Parental Control", | ||
48 | - "Parental Control is peace of mind that your kids are safe" + | ||
49 | - " - whether you are around or away. Indicate with a " + | ||
50 | - "few clicks what online content is appropriate for " + | ||
51 | - "your children, and voila - you have control over" + | ||
52 | - " what your kids can and cannot view.", | ||
53 | - true, | ||
54 | - true), | ||
55 | - | ||
56 | - /** | ||
57 | - * Content Distribution function. | ||
58 | - */ | ||
59 | - CDN("cdn", | ||
60 | - "CDN", | ||
61 | - "Content Distribution Network service.", | ||
62 | - true, | ||
63 | - false); | ||
64 | - | ||
65 | - | ||
66 | - private final String id; | ||
67 | - private final String displayName; | ||
68 | - private final String description; | ||
69 | - private final boolean backend; | ||
70 | - private final boolean visible; | ||
71 | - | ||
72 | - XosFunctionDescriptor(String id, String displayName, String description, | ||
73 | - boolean backend, boolean visible) { | ||
74 | - this.id = id; | ||
75 | - this.displayName = displayName; | ||
76 | - this.description = description; | ||
77 | - this.backend = backend; | ||
78 | - this.visible = visible; | ||
79 | - } | ||
80 | - | ||
81 | - /** | ||
82 | - * Returns this function's internal identifier. | ||
83 | - * | ||
84 | - * @return the identifier | ||
85 | - */ | ||
86 | - public String id() { | ||
87 | - return id; | ||
88 | - } | ||
89 | - | ||
90 | - /** | ||
91 | - * Returns this function's display name. | ||
92 | - * | ||
93 | - * @return display name | ||
94 | - */ | ||
95 | - public String displayName() { | ||
96 | - return displayName; | ||
97 | - } | ||
98 | - | ||
99 | - /** | ||
100 | - * Returns a short, textual description of the function. | ||
101 | - * | ||
102 | - * @return textual description | ||
103 | - */ | ||
104 | - public String description() { | ||
105 | - return description; | ||
106 | - } | ||
107 | - | ||
108 | - /** | ||
109 | - * Returns true if this function is supported by the XOS backend. | ||
110 | - * | ||
111 | - * @return true if backend function exists | ||
112 | - */ | ||
113 | - public boolean backend() { | ||
114 | - return backend; | ||
115 | - } | ||
116 | - | ||
117 | - /** | ||
118 | - * Returns true if this function should be shown in the GUI, in the | ||
119 | - * bundle listing. | ||
120 | - * | ||
121 | - * @return true if to be displayed | ||
122 | - */ | ||
123 | - public boolean visible() { | ||
124 | - return visible; | ||
125 | - } | ||
126 | -} |
apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/XosFunctionFactory.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.cord.gui.model; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.databind.node.ArrayNode; | ||
19 | -import com.fasterxml.jackson.databind.node.ObjectNode; | ||
20 | - | ||
21 | -import java.util.HashMap; | ||
22 | -import java.util.Map; | ||
23 | - | ||
24 | -import static org.onosproject.cord.gui.model.XosFunctionDescriptor.URL_FILTER; | ||
25 | - | ||
26 | -/** | ||
27 | - * Utility factory for operating on XOS functions. | ||
28 | - */ | ||
29 | -public class XosFunctionFactory extends JsonFactory { | ||
30 | - | ||
31 | - private static final String PARAMS = "params"; | ||
32 | - private static final String LEVEL = "level"; | ||
33 | - private static final String LEVELS = "levels"; | ||
34 | - | ||
35 | - | ||
36 | - // no instantiation | ||
37 | - private XosFunctionFactory() {} | ||
38 | - | ||
39 | - /** | ||
40 | - * Produces the JSON representation of the given XOS function descriptor. | ||
41 | - * | ||
42 | - * @param xfd function descriptor | ||
43 | - * @return JSON encoding | ||
44 | - */ | ||
45 | - public static ObjectNode toObjectNode(XosFunctionDescriptor xfd) { | ||
46 | - ObjectNode root = objectNode() | ||
47 | - .put(ID, xfd.id()) | ||
48 | - .put(NAME, xfd.displayName()) | ||
49 | - .put(DESC, xfd.description()); | ||
50 | - root.set(PARAMS, paramsForXfd(xfd)); | ||
51 | - return root; | ||
52 | - } | ||
53 | - | ||
54 | - private static ObjectNode paramsForXfd(XosFunctionDescriptor xfd) { | ||
55 | - ParamsFactory psf = PARAM_MAP.get(xfd); | ||
56 | - if (psf == null) { | ||
57 | - psf = DEF_PARAMS_FACTORY; | ||
58 | - } | ||
59 | - return psf.params(); | ||
60 | - } | ||
61 | - | ||
62 | - | ||
63 | - // ==== handling different parameter structures... | ||
64 | - private static final Map<XosFunctionDescriptor, ParamsFactory> | ||
65 | - PARAM_MAP = new HashMap<XosFunctionDescriptor, ParamsFactory>(); | ||
66 | - | ||
67 | - private static final ParamsFactory DEF_PARAMS_FACTORY = new ParamsFactory(); | ||
68 | - static { | ||
69 | - PARAM_MAP.put(URL_FILTER, new UrlFilterParamsFactory()); | ||
70 | - } | ||
71 | - | ||
72 | - /** | ||
73 | - * Creates an object node representation of the profile for the | ||
74 | - * specified user. | ||
75 | - * | ||
76 | - * @param user the user | ||
77 | - * @return object node profile | ||
78 | - */ | ||
79 | - public static ObjectNode profileForUser(SubscriberUser user) { | ||
80 | - ObjectNode root = objectNode(); | ||
81 | - for (XosFunctionDescriptor xfd: XosFunctionDescriptor.values()) { | ||
82 | - XosFunction.Memento mem = user.getMemento(xfd); | ||
83 | - if (mem != null) { | ||
84 | - root.set(xfd.id(), mem.toObjectNode()); | ||
85 | - } | ||
86 | - } | ||
87 | - return root; | ||
88 | - } | ||
89 | - | ||
90 | - | ||
91 | - // =================================================================== | ||
92 | - // === factories for creating parameter structures, both default | ||
93 | - // and from a memento... | ||
94 | - | ||
95 | - // private parameter structure creator | ||
96 | - static class ParamsFactory { | ||
97 | - ObjectNode params() { | ||
98 | - return objectNode(); | ||
99 | - } | ||
100 | - } | ||
101 | - | ||
102 | - static class UrlFilterParamsFactory extends ParamsFactory { | ||
103 | - @Override | ||
104 | - ObjectNode params() { | ||
105 | - ObjectNode result = objectNode(); | ||
106 | - result.put(LEVEL, UrlFilterFunction.DEFAULT_LEVEL.name()); | ||
107 | - ArrayNode levels = arrayNode(); | ||
108 | - for (UrlFilterFunction.Level lvl: UrlFilterFunction.Level.values()) { | ||
109 | - levels.add(lvl.name()); | ||
110 | - } | ||
111 | - result.set(LEVELS, levels); | ||
112 | - return result; | ||
113 | - } | ||
114 | - } | ||
115 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/local/bundle-0.json
deleted
100644 → 0
1 | -{ | ||
2 | - "bundle": { | ||
3 | - "id": "basic", | ||
4 | - "name": "Basic Bundle", | ||
5 | - "functions": [ | ||
6 | - { | ||
7 | - "id": "internet", | ||
8 | - "name": "Internet", | ||
9 | - "desc": "Basic internet connectivity.", | ||
10 | - "params": {} | ||
11 | - }, | ||
12 | - { | ||
13 | - "id": "firewall", | ||
14 | - "name": "Firewall", | ||
15 | - "desc": "Normal firewall protection.", | ||
16 | - "params": {} | ||
17 | - } | ||
18 | - ] | ||
19 | - }, | ||
20 | - "bundles": [ | ||
21 | - { "id": "basic", "name": "Basic Bundle" }, | ||
22 | - { "id": "family", "name": "Family Bundle" } | ||
23 | - ] | ||
24 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/local/bundle-1.json
deleted
100644 → 0
1 | -{ | ||
2 | - "bundle": { | ||
3 | - "id": "family", | ||
4 | - "name": "Family Bundle", | ||
5 | - "functions": [ | ||
6 | - { | ||
7 | - "id": "internet", | ||
8 | - "name": "Internet", | ||
9 | - "desc": "Basic internet connectivity.", | ||
10 | - "params": {} | ||
11 | - }, | ||
12 | - { | ||
13 | - "id": "firewall", | ||
14 | - "name": "Firewall", | ||
15 | - "desc": "Normal firewall protection.", | ||
16 | - "params": {} | ||
17 | - }, | ||
18 | - { | ||
19 | - "id": "url_filter", | ||
20 | - "name": "Parental Control", | ||
21 | - "desc": "Variable levels of URL filtering.", | ||
22 | - "params": { | ||
23 | - "level": "PG", | ||
24 | - "levels": [ "PG", "PG-13", "R" ] | ||
25 | - } | ||
26 | - } | ||
27 | - ] | ||
28 | - }, | ||
29 | - "bundles": [ | ||
30 | - { "id": "basic", "name": "Basic Bundle" }, | ||
31 | - { "id": "family", "name": "Family Bundle" } | ||
32 | - ] | ||
33 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/local/dashboard-0.json
deleted
100644 → 0
1 | -{ | ||
2 | - "bundle": "Basic Bundle", | ||
3 | - "users": [ | ||
4 | - { "id": 1, "name": "Mom's MacBook", "mac": "00:11:22:33:44:55" }, | ||
5 | - { "id": 1, "name": "Dad's iPad", "mac": "00:11:22:33:44:66" }, | ||
6 | - { "id": 1, "name": "Dick's laptop", "mac": "00:11:22:33:44:77" }, | ||
7 | - { "id": 1, "name": "Jane's laptop", "mac": "00:11:22:33:44:88" } | ||
8 | - ] | ||
9 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/local/dashboard-1.json
deleted
100644 → 0
1 | -{ | ||
2 | - "bundle": "Family Bundle", | ||
3 | - "users": [ | ||
4 | - { "id": 1, "name": "Mom's MacBook", "mac": "00:11:22:33:44:55" }, | ||
5 | - { "id": 1, "name": "Dad's iPad", "mac": "00:11:22:33:44:66" }, | ||
6 | - { "id": 1, "name": "Dick's laptop", "mac": "00:11:22:33:44:77" }, | ||
7 | - { "id": 1, "name": "Jane's laptop", "mac": "00:11:22:33:44:88" } | ||
8 | - ] | ||
9 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/local/users-0.json
deleted
100644 → 0
1 | -{ | ||
2 | - "users": [ | ||
3 | - { | ||
4 | - "id": 1, | ||
5 | - "name": "Mom's MacBook", | ||
6 | - "mac": "01:02:03:04:05:06", | ||
7 | - "profile": { } | ||
8 | - }, | ||
9 | - { | ||
10 | - "id": 2, | ||
11 | - "name": "Dad's iPad", | ||
12 | - "mac": "01:02:03:04:05:77", | ||
13 | - "profile": { } | ||
14 | - }, | ||
15 | - { | ||
16 | - "id": 3, | ||
17 | - "name": "Dick's laptop", | ||
18 | - "mac": "01:02:03:04:05:88", | ||
19 | - "profile": { } | ||
20 | - }, | ||
21 | - { | ||
22 | - "id": 4, | ||
23 | - "name": "Jane's laptop", | ||
24 | - "mac": "01:02:03:04:05:99", | ||
25 | - "profile": { } | ||
26 | - } | ||
27 | - ] | ||
28 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/local/users-1.json
deleted
100644 → 0
1 | -{ | ||
2 | - "users": [ | ||
3 | - { | ||
4 | - "id": 1, | ||
5 | - "name": "Mom's MacBook", | ||
6 | - "mac": "010203040506", | ||
7 | - "profile": { | ||
8 | - "url_filter": { | ||
9 | - "level": "R" | ||
10 | - } | ||
11 | - } | ||
12 | - }, | ||
13 | - { | ||
14 | - "id": 2, | ||
15 | - "name": "Dad's iPad", | ||
16 | - "mac": "010203040507", | ||
17 | - "profile": { | ||
18 | - "url_filter": { | ||
19 | - "level": "R" | ||
20 | - } | ||
21 | - } | ||
22 | - }, | ||
23 | - { | ||
24 | - "id": 3, | ||
25 | - "name": "Dick's laptop", | ||
26 | - "mac": "010203040508", | ||
27 | - "profile": { | ||
28 | - "url_filter": { | ||
29 | - "level": "PG_13" | ||
30 | - } | ||
31 | - } | ||
32 | - }, | ||
33 | - { | ||
34 | - "id": 4, | ||
35 | - "name": "Jane's laptop", | ||
36 | - "mac": "010203040509", | ||
37 | - "profile": { | ||
38 | - "url_filter": { | ||
39 | - "level": "PG" | ||
40 | - } | ||
41 | - } | ||
42 | - } | ||
43 | - ] | ||
44 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/xos/subscriber-1-users.json
deleted
100644 → 0
1 | -{ | ||
2 | - "users": [ | ||
3 | - { | ||
4 | - "id": 1, | ||
5 | - "name": "Mom's MacBook", | ||
6 | - "mac": "01:02:03:04:05:06" | ||
7 | - }, | ||
8 | - { | ||
9 | - "id": 2, | ||
10 | - "name": "Dad's iPad", | ||
11 | - "mac": "01:02:03:04:05:77" | ||
12 | - }, | ||
13 | - { | ||
14 | - "id": 3, | ||
15 | - "name": "Dick's laptop", | ||
16 | - "mac": "01:02:03:04:05:88" | ||
17 | - }, | ||
18 | - { | ||
19 | - "id": 4, | ||
20 | - "name": "Jane's laptop", | ||
21 | - "mac": "01:02:03:04:05:99" | ||
22 | - } | ||
23 | - ] | ||
24 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/xos/subscriber-1.json
deleted
100644 → 0
1 | -{ | ||
2 | - "humanReadableName": "vOLT on service 16", | ||
3 | - "id": 1, | ||
4 | - "service_specific_id": "", | ||
5 | - "vlan_id": null, | ||
6 | - "vcpe_id": 2, | ||
7 | - "sliver": 384, | ||
8 | - "sliver_name": "onlab_vcpe", | ||
9 | - "image": 29, | ||
10 | - "image_name": "Ubuntu 14.04 LTS", | ||
11 | - "firewall_enable": true, | ||
12 | - "firewall_rules": "accept all anywhere anywhere", | ||
13 | - "url_filter_enable": true, | ||
14 | - "url_filter_rules": "allow all", | ||
15 | - "url_filter_level": "PG", | ||
16 | - "cdn_enable": true, | ||
17 | - "vbng_id": 4, | ||
18 | - "routeable_subnet": "1.1.1.1/4" | ||
19 | -} |
1 | -{ | ||
2 | - "users": [ | ||
3 | - { | ||
4 | - "mac": "010203040506", | ||
5 | - "name": "Moms laptop", | ||
6 | - "id": 0 | ||
7 | - }, | ||
8 | - { | ||
9 | - "mac": "010203040507", | ||
10 | - "name": "Dads desktop", | ||
11 | - "id": 1 | ||
12 | - }, | ||
13 | - { | ||
14 | - "id": 2, | ||
15 | - "mac": "010203040507", | ||
16 | - "name": "Jacks iPad", | ||
17 | - "level": "PG" | ||
18 | - }, | ||
19 | - { | ||
20 | - "mac": "010203040508", | ||
21 | - "name": "Jills iPad", | ||
22 | - "id": 3 | ||
23 | - } | ||
24 | - ] | ||
25 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/xos/subscriber-92-users.json
deleted
100644 → 0
1 | -{ | ||
2 | - "users": [ | ||
3 | - { | ||
4 | - "mac": "010203040506", | ||
5 | - "name": "Moms laptop", | ||
6 | - "id": 0 | ||
7 | - }, | ||
8 | - { | ||
9 | - "mac": "010203040507", | ||
10 | - "name": "Dads desktop", | ||
11 | - "id": 1 | ||
12 | - }, | ||
13 | - { | ||
14 | - "mac": "010203040507", | ||
15 | - "name": "Jacks iPad", | ||
16 | - "id": 2 | ||
17 | - }, | ||
18 | - { | ||
19 | - "mac": "010203040508", | ||
20 | - "name": "Jills iPad", | ||
21 | - "id": 3 | ||
22 | - } | ||
23 | - ] | ||
24 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/xos/subscriber-92.json
deleted
100644 → 0
1 | -{ | ||
2 | - "humanReadableName": "vOLT on service 1", | ||
3 | - "id": 92, | ||
4 | - "service_specific_id": "33445573", | ||
5 | - "vlan_id": "77889908", | ||
6 | - "vcpe_id": 93, | ||
7 | - "sliver": 108, | ||
8 | - "sliver_name": "mysite_vcpe", | ||
9 | - "image": 1, | ||
10 | - "image_name": "Ubuntu-14.04-LTS", | ||
11 | - "firewall_enable": false, | ||
12 | - "firewall_rules": "accept all anywhere anywhere", | ||
13 | - "url_filter_enable": false, | ||
14 | - "url_filter_rules": "allow all", | ||
15 | - "url_filter_level": "R", | ||
16 | - "cdn_enable": false, | ||
17 | - "vbng_id": 94, | ||
18 | - "routeable_subnet": "", | ||
19 | - "nat_ip": "172.16.0.106", | ||
20 | - "lan_ip": "12.0.0.16", | ||
21 | - "wan_ip": "11.0.0.16", | ||
22 | - "private_ip": "10.0.6.43" | ||
23 | -} |
apps/demo/cord-gui/src/main/resources/org/onosproject/cord/gui/xos/subscriber.json
deleted
100644 → 0
1 | -{ | ||
2 | - "subscribers": [ | ||
3 | - { | ||
4 | - "humanReadableName": "vOLT on service 1", | ||
5 | - "id": 92, | ||
6 | - "service_specific_id": "33445573", | ||
7 | - "vlan_id": "77889908", | ||
8 | - "vcpe_id": 93, | ||
9 | - "sliver": 108, | ||
10 | - "sliver_name": "mysite_vcpe", | ||
11 | - "image": 1, | ||
12 | - "image_name": "Ubuntu-14.04-LTS", | ||
13 | - "firewall_enable": false, | ||
14 | - "firewall_rules": "accept all anywhere anywhere", | ||
15 | - "url_filter_enable": false, | ||
16 | - "url_filter_rules": "allow all", | ||
17 | - "url_filter_level": "R", | ||
18 | - "cdn_enable": false, | ||
19 | - "vbng_id": 94, | ||
20 | - "routeable_subnet": "", | ||
21 | - "nat_ip": "172.16.0.106", | ||
22 | - "lan_ip": "12.0.0.16", | ||
23 | - "wan_ip": "11.0.0.16", | ||
24 | - "private_ip": "10.0.6.43" | ||
25 | - }, | ||
26 | - { | ||
27 | - "humanReadableName": "vOLT on service 1", | ||
28 | - "id": 138, | ||
29 | - "service_specific_id": "", | ||
30 | - "vlan_id": "100", | ||
31 | - "vcpe_id": 139, | ||
32 | - "sliver": 106, | ||
33 | - "sliver_name": "mysite_vcpe", | ||
34 | - "image": 1, | ||
35 | - "image_name": "Ubuntu-14.04-LTS", | ||
36 | - "firewall_enable": false, | ||
37 | - "firewall_rules": "accept all anywhere anywhere", | ||
38 | - "url_filter_enable": false, | ||
39 | - "url_filter_rules": "allow all", | ||
40 | - "url_filter_level": "PG", | ||
41 | - "cdn_enable": false, | ||
42 | - "vbng_id": 140, | ||
43 | - "routeable_subnet": "", | ||
44 | - "nat_ip": "172.16.0.104", | ||
45 | - "lan_ip": "12.0.0.14", | ||
46 | - "wan_ip": "11.0.0.14", | ||
47 | - "private_ip": "10.0.6.41" | ||
48 | - }, | ||
49 | - { | ||
50 | - "humanReadableName": "vOLT on service 1", | ||
51 | - "id": 154, | ||
52 | - "service_specific_id": "98765", | ||
53 | - "vlan_id": "99", | ||
54 | - "vcpe_id": 155, | ||
55 | - "sliver": 117, | ||
56 | - "sliver_name": "mysite_vcpe", | ||
57 | - "image": 1, | ||
58 | - "image_name": "Ubuntu-14.04-LTS", | ||
59 | - "firewall_enable": false, | ||
60 | - "firewall_rules": "accept all anywhere anywhere", | ||
61 | - "url_filter_enable": false, | ||
62 | - "url_filter_rules": "allow all", | ||
63 | - "url_filter_level": "PG", | ||
64 | - "cdn_enable": false, | ||
65 | - "vbng_id": 156, | ||
66 | - "routeable_subnet": "", | ||
67 | - "nat_ip": "172.16.0.114", | ||
68 | - "lan_ip": "12.0.0.24", | ||
69 | - "wan_ip": "11.0.0.24", | ||
70 | - "private_ip": "10.0.6.48" | ||
71 | - }, | ||
72 | - { | ||
73 | - "humanReadableName": "vOLT on service 1", | ||
74 | - "id": 157, | ||
75 | - "service_specific_id": "5678", | ||
76 | - "vlan_id": "999", | ||
77 | - "vcpe_id": 158, | ||
78 | - "sliver": 118, | ||
79 | - "sliver_name": "mysite_vcpe", | ||
80 | - "image": 1, | ||
81 | - "image_name": "Ubuntu-14.04-LTS", | ||
82 | - "firewall_enable": false, | ||
83 | - "firewall_rules": "accept all anywhere anywhere", | ||
84 | - "url_filter_enable": false, | ||
85 | - "url_filter_rules": "allow all", | ||
86 | - "url_filter_level": "PG", | ||
87 | - "cdn_enable": false, | ||
88 | - "vbng_id": 159, | ||
89 | - "routeable_subnet": "", | ||
90 | - "nat_ip": "172.16.0.119", | ||
91 | - "lan_ip": "12.0.0.29", | ||
92 | - "wan_ip": "11.0.0.29", | ||
93 | - "private_ip": "10.0.6.53" | ||
94 | - }, | ||
95 | - { | ||
96 | - "humanReadableName": "vOLT on service 1", | ||
97 | - "id": 160, | ||
98 | - "service_specific_id": "1", | ||
99 | - "vlan_id": "100", | ||
100 | - "vcpe_id": 161, | ||
101 | - "sliver": 119, | ||
102 | - "sliver_name": "mysite_vcpe", | ||
103 | - "image": 1, | ||
104 | - "image_name": "Ubuntu-14.04-LTS", | ||
105 | - "firewall_enable": false, | ||
106 | - "firewall_rules": "accept all anywhere anywhere", | ||
107 | - "url_filter_enable": false, | ||
108 | - "url_filter_rules": "allow all", | ||
109 | - "url_filter_level": "PG", | ||
110 | - "cdn_enable": false, | ||
111 | - "vbng_id": 162, | ||
112 | - "routeable_subnet": "", | ||
113 | - "nat_ip": "172.16.0.120", | ||
114 | - "lan_ip": "12.0.0.30", | ||
115 | - "wan_ip": "11.0.0.30", | ||
116 | - "private_ip": "10.0.6.54" | ||
117 | - }, | ||
118 | - { | ||
119 | - "humanReadableName": "vOLT on service 1", | ||
120 | - "id": 163, | ||
121 | - "service_specific_id": "101", | ||
122 | - "vlan_id": "101", | ||
123 | - "vcpe_id": 164, | ||
124 | - "sliver": 120, | ||
125 | - "sliver_name": "mysite_vcpe", | ||
126 | - "image": 1, | ||
127 | - "image_name": "Ubuntu-14.04-LTS", | ||
128 | - "firewall_enable": false, | ||
129 | - "firewall_rules": "accept all anywhere anywhere", | ||
130 | - "url_filter_enable": false, | ||
131 | - "url_filter_rules": "allow all", | ||
132 | - "url_filter_level": "PG", | ||
133 | - "cdn_enable": false, | ||
134 | - "vbng_id": 165, | ||
135 | - "routeable_subnet": "", | ||
136 | - "nat_ip": "172.16.0.121", | ||
137 | - "lan_ip": "12.0.0.31", | ||
138 | - "wan_ip": "11.0.0.31", | ||
139 | - "private_ip": "10.0.6.55" | ||
140 | - } | ||
141 | - ] | ||
142 | -} |
1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
2 | -<!-- | ||
3 | - ~ Copyright 2015-present Open Networking Laboratory | ||
4 | - ~ | ||
5 | - ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | - ~ you may not use this file except in compliance with the License. | ||
7 | - ~ You may obtain a copy of the License at | ||
8 | - ~ | ||
9 | - ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | - ~ | ||
11 | - ~ Unless required by applicable law or agreed to in writing, software | ||
12 | - ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | - ~ See the License for the specific language governing permissions and | ||
15 | - ~ limitations under the License. | ||
16 | - --> | ||
17 | -<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" | ||
18 | - xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
19 | - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
20 | - id="ONOS" version="2.5"> | ||
21 | - <display-name>CORD Subscriber Web GUI</display-name> | ||
22 | - | ||
23 | - <servlet> | ||
24 | - <servlet-name>JAX-RS Service</servlet-name> | ||
25 | - <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> | ||
26 | - <init-param> | ||
27 | - <param-name>jersey.config.server.provider.classnames</param-name> | ||
28 | - <param-value> | ||
29 | - org.onosproject.cord.gui.CordWebResource | ||
30 | - </param-value> | ||
31 | - </init-param> | ||
32 | - <load-on-startup>1</load-on-startup> | ||
33 | - </servlet> | ||
34 | - | ||
35 | - <servlet-mapping> | ||
36 | - <servlet-name>JAX-RS Service</servlet-name> | ||
37 | - <url-pattern>/rs/*</url-pattern> | ||
38 | - </servlet-mapping> | ||
39 | - | ||
40 | -</web-app> |
1 | -{ | ||
2 | - "_comment_": "Parental Control Categories - data file", | ||
3 | - | ||
4 | - "level_order": [ | ||
5 | - "NONE", "G", "PG", "PG_13", "R", "ALL" | ||
6 | - ], | ||
7 | - | ||
8 | - "category_order": [ | ||
9 | - "Safe", "Search", "Shopping", "Sports", "Privacy", "Dating", "Games", | ||
10 | - "Social", "Illegal", "Weapons", "Drugs", "Gambling", "Cyberbully", | ||
11 | - "Pornography", "Adult", "Anonymizers", "Suicide", "Malware" | ||
12 | - ], | ||
13 | - | ||
14 | - "descriptions": { | ||
15 | - "Safe": [ | ||
16 | - "." | ||
17 | - ], | ||
18 | - "Search": [ | ||
19 | - "Sites which provide the ability to perform searches for specific ", | ||
20 | - "topics or websites across the entire Internet, and which display ", | ||
21 | - "results in a multi-page format that allows material to be sorted ", | ||
22 | - "based on content, topic, or file type." | ||
23 | - ], | ||
24 | - "Shopping": [ | ||
25 | - "." | ||
26 | - ], | ||
27 | - "Sports": [ | ||
28 | - "Sites which analyze, promote, or providing information about ", | ||
29 | - "competitive sports and its fans whether official or unofficial." | ||
30 | - ], | ||
31 | - "Privacy": [ | ||
32 | - "Sites which provide hosted online advertising intended to attract ", | ||
33 | - "web traffic, deliver marketing messages or capture email addresses." | ||
34 | - ], | ||
35 | - "Dating": [ | ||
36 | - "Sites which promote or provide the opportunity for establishing ", | ||
37 | - "romantic relationship." | ||
38 | - ], | ||
39 | - "Games": [ | ||
40 | - "Sites which related to the development, promotion, review, and ", | ||
41 | - "enjoyment of online, PC, and console videogaming." | ||
42 | - ], | ||
43 | - "Social": [ | ||
44 | - "Sites which facilitate online socializing and the development or ", | ||
45 | - "maintenance of personal and professional relationships across ", | ||
46 | - "geographical and organizational boundaries." | ||
47 | - ], | ||
48 | - "Illegal": [ | ||
49 | - "Sites which promote or provide the means to practice illegal or ", | ||
50 | - "unauthorized acts using computer-programming skills. And sites ", | ||
51 | - "which offer custom academic writing services for free or for ", | ||
52 | - "purchase. These sites are geared toward students who do not want ", | ||
53 | - "to write their own papers, but will download or buy previously ", | ||
54 | - "written or custom written papers." | ||
55 | - ], | ||
56 | - "Weapons": [ | ||
57 | - "Sites which sell, manufacture, or describe the manufacture of weapons." | ||
58 | - ], | ||
59 | - "Drugs": [ | ||
60 | - "Sites which promote, offer, sell, supply, encourage or otherwise ", | ||
61 | - "advocate the recreational or illegal use, cultivation, manufacture, ", | ||
62 | - "or distribution of drugs, pharmaceuticals, intoxicating plants or ", | ||
63 | - "chemicals and their related paraphernalia. And sites which glamorize, ", | ||
64 | - "glorify, tout or otherwise encourage the consumption of alcohol. And ", | ||
65 | - "sites which sell, glamorize, enable or encourage the use of tobacco ", | ||
66 | - "and tobacco-related products." | ||
67 | - ], | ||
68 | - "Gambling": [ | ||
69 | - "." | ||
70 | - ], | ||
71 | - "Cyberbully": [ | ||
72 | - "Sites or pages where people post targeted, deliberate and slanderous ", | ||
73 | - "or offensive content about other people with the INTENT to torment, ", | ||
74 | - "threaten, humiliate or defame them. Content is often sexual, ", | ||
75 | - "malicious or hostile in nature and is submitted via interactive ", | ||
76 | - "digital technology. And sites which advocate hostility, aggression ", | ||
77 | - "and the denigration of an individual or group on the basis of race, ", | ||
78 | - "religion, gender, nationality, ethnic origin, or other involuntary ", | ||
79 | - "characteristics. Sites that use purported scientific or commonly ", | ||
80 | - "accredited methods to justify inequality, aggression, and hostility." | ||
81 | - ], | ||
82 | - "Pornography": [ | ||
83 | - "Sites which contain explicit material for the purpose of causing ", | ||
84 | - "sexual excitement or arousing lascivious interest." | ||
85 | - ], | ||
86 | - "Adult": [ | ||
87 | - "Sites which contain sexually explicit information that is not ", | ||
88 | - "medical or scientific nature and yet are also not pornographic. ", | ||
89 | - "And sites which feature social or family nudism/naturism, nudist ", | ||
90 | - "camps/resorts, or „nudist-only‟ travel." | ||
91 | - ], | ||
92 | - "Anonymizers": [ | ||
93 | - "Sites which provide anonymous access to websites through a PHP or ", | ||
94 | - "CGI proxy, allowing users to gain access to websites blocked by ", | ||
95 | - "corporate and school proxies as well as parental control filtering ", | ||
96 | - "solutions." | ||
97 | - ], | ||
98 | - "Suicide": [ | ||
99 | - "Sites which advocate, normalize, or glamourize repetitive and ", | ||
100 | - "deliberate ways to inflict non-fatal harm to oneself. And sites ", | ||
101 | - "advocating or glorifying suicide as well as educating people on how ", | ||
102 | - "to commit suicide." | ||
103 | - ], | ||
104 | - "Malware": [ | ||
105 | - "Sites where the domain was found to either contain malware or take ", | ||
106 | - "advantage of other exploits to deliver adware, spyware or malware. ", | ||
107 | - "And Sites that contain direct links to malware file downloads: ", | ||
108 | - ".exe, .dll, .ocx, and others. These URLs are generally highly malicious." | ||
109 | - ] | ||
110 | - }, | ||
111 | - | ||
112 | - "_prohibited_comment_": [ | ||
113 | - "Note: Level NONE allows nothing (prohibits everything)", | ||
114 | - " level ALL allows everything (prohibits nothing)", | ||
115 | - " Levels G, PG, PG_13, R prohibitions listed below:" | ||
116 | - ], | ||
117 | - | ||
118 | - "prohibited": { | ||
119 | - "G": [ | ||
120 | - "Games", "Social", "Illegal", "Weapons", "Drugs", "Gambling", | ||
121 | - "Cyberbully", "Pornography", "Adult", "Anonymizers", "Suicide", "Malware" | ||
122 | - ], | ||
123 | - "PG": [ | ||
124 | - "Social", "Illegal", "Weapons", "Drugs", "Gambling", | ||
125 | - "Cyberbully", "Pornography", "Adult", "Anonymizers", "Suicide", "Malware" | ||
126 | - ], | ||
127 | - "PG_13": [ | ||
128 | - "Illegal", "Weapons", "Drugs", "Gambling", | ||
129 | - "Cyberbully", "Pornography", "Adult", "Anonymizers", "Suicide", "Malware" | ||
130 | - ], | ||
131 | - "R": [ | ||
132 | - "Pornography", "Adult", "Anonymizers", "Suicide", "Malware" | ||
133 | - ] | ||
134 | - } | ||
135 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -div.foot { | ||
18 | - width: 100%; | ||
19 | - height: 30px; | ||
20 | - background-color: white; | ||
21 | - position: absolute; | ||
22 | - left: 0; | ||
23 | - right: 0; | ||
24 | - bottom: 0; | ||
25 | - margin-left: auto; | ||
26 | - margin-right: auto; | ||
27 | - z-index: 100; | ||
28 | - box-shadow: 0 10px 5px 10px gray; | ||
29 | -} | ||
30 | - | ||
31 | -.foot div { | ||
32 | - position: absolute; | ||
33 | - top: 50%; | ||
34 | - transform: translate(0, -50%); | ||
35 | - font-style: italic; | ||
36 | - font-size: 12px; | ||
37 | - color: #3C3C3C; | ||
38 | -} | ||
39 | - | ||
40 | -.foot div.left { | ||
41 | - left: 25px; | ||
42 | -} | ||
43 | - | ||
44 | -.foot div.right { | ||
45 | - right: 25px; | ||
46 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -angular.module('cordFoot', []) | ||
18 | - .directive('foot', function () { | ||
19 | - return { | ||
20 | - restrict: 'E', | ||
21 | - templateUrl: 'app/fw/foot/foot.html' | ||
22 | - }; | ||
23 | - }); |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -(function () { | ||
18 | - 'use strict'; | ||
19 | - | ||
20 | - angular.module('cordGui') | ||
21 | - | ||
22 | - .directive('icon', [function () { | ||
23 | - return { | ||
24 | - restrict: 'E', | ||
25 | - compile: function (element, attrs) { | ||
26 | - var html = | ||
27 | - '<svg class="embedded-icon" width="' + attrs.size + '" ' + | ||
28 | - 'height="' + attrs.size + '" viewBox="0 0 50 50">' + | ||
29 | - '<g class="icon">' + | ||
30 | - '<circle cx="25" cy="25" r="25"></circle>' + | ||
31 | - '<use width="50" height="50" class="glyph ' | ||
32 | - + attrs.id + '" xlink:href="#' + attrs.id + | ||
33 | - '"></use>' + | ||
34 | - '</g>' + | ||
35 | - '</svg>'; | ||
36 | - element.replaceWith(html); | ||
37 | - } | ||
38 | - }; | ||
39 | - }]); | ||
40 | -}()); |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -div.mast { | ||
18 | - width: 100%; | ||
19 | - height: 85px; | ||
20 | - background-color: white; | ||
21 | - position: relative; | ||
22 | - box-shadow: 0 10px 5px -7px gray; | ||
23 | - z-index: 100; | ||
24 | -} | ||
25 | - | ||
26 | -.mast div { | ||
27 | - position: absolute; | ||
28 | - top: 50%; | ||
29 | - transform: translate(0, -50%); | ||
30 | -} | ||
31 | - | ||
32 | -.mast div.left { | ||
33 | - left: 25px; | ||
34 | -} | ||
35 | - | ||
36 | -.mast div.right { | ||
37 | - right: 7%; | ||
38 | - width: 37%; | ||
39 | -} | ||
40 | - | ||
41 | -.mast img { | ||
42 | - width: 220px; | ||
43 | -} | ||
44 | - | ||
45 | -.mast a, | ||
46 | -.mast a:visited { | ||
47 | - text-decoration: none; | ||
48 | - color: #3C3C3C; | ||
49 | -} | ||
50 | - | ||
51 | -.mast li.logout { | ||
52 | - list-style-type: none; | ||
53 | - position: absolute; | ||
54 | - right: 0; | ||
55 | - top: 50%; | ||
56 | - transform: translate(0, -50%); | ||
57 | - font-size: 90%; | ||
58 | -} | ||
59 | -.mast li.logout:hover { | ||
60 | - font-weight: bold; | ||
61 | - list-style-type: none; | ||
62 | - cursor: pointer; | ||
63 | -} |
1 | -<!--Mast HTML--> | ||
2 | - | ||
3 | -<div class="mast" ng-controller="CordMastCtrl"> | ||
4 | - <div class="left"> | ||
5 | - <img src="/imgs/logo.png"> | ||
6 | - </div> | ||
7 | - | ||
8 | - <div class="right"> | ||
9 | - <nav ng-show="page.curr !== 'login'"></nav> | ||
10 | - <li class="logout" | ||
11 | - ng-show="page.curr !== 'login'" | ||
12 | - ng-click="logout()">LOGOUT</li> | ||
13 | - </div> | ||
14 | -</div> |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -(function () { | ||
18 | - 'use strict'; | ||
19 | - | ||
20 | - var urlSuffix = '/rs/logout'; | ||
21 | - | ||
22 | - angular.module('cordMast', []) | ||
23 | - .controller('CordMastCtrl', | ||
24 | - ['$log','$scope', '$resource', '$location', '$window', | ||
25 | - function ($log, $scope, $resource, $location, $window) { | ||
26 | - var LogoutData, resource; | ||
27 | - | ||
28 | - $scope.logout = function () { | ||
29 | - $log.debug('Logging out...'); | ||
30 | - LogoutData = $resource($scope.shared.url + urlSuffix); | ||
31 | - resource = LogoutData.get({}, | ||
32 | - function () { | ||
33 | - $location.path('/login'); | ||
34 | - $window.location.href = $location.absUrl(); | ||
35 | - $log.debug('Resource received:', resource); | ||
36 | - }); | ||
37 | - }; | ||
38 | - }]) | ||
39 | - | ||
40 | - .directive('mast', function () { | ||
41 | - return { | ||
42 | - restrict: 'E', | ||
43 | - templateUrl: 'app/fw/mast/mast.html' | ||
44 | - }; | ||
45 | - }); | ||
46 | -}()); |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -.nav ul { | ||
18 | - display: table; | ||
19 | - table-layout: fixed; | ||
20 | - list-style-type: none; | ||
21 | - width: 80%; | ||
22 | -} | ||
23 | - | ||
24 | -.nav li { | ||
25 | - padding: 2.5% 0; | ||
26 | - color: #3C3C3C; | ||
27 | -} | ||
28 | -.nav li:hover { | ||
29 | - border-bottom: 2px solid #CE5650; | ||
30 | - color: black; | ||
31 | -} | ||
32 | -.nav li.selected { | ||
33 | - font-weight: bolder; | ||
34 | - color: #3C3C3C; | ||
35 | - letter-spacing: 0.03em; | ||
36 | - border-bottom: 2px solid #CE5650; | ||
37 | -} | ||
38 | - | ||
39 | -.nav a, | ||
40 | -.nav a:visited { | ||
41 | - display: table-cell; | ||
42 | - text-align: center; | ||
43 | - text-decoration: none; | ||
44 | - color: black; | ||
45 | -} |
1 | -<!--Nav HTML--> | ||
2 | -<div class="nav"> | ||
3 | - <ul> | ||
4 | - <a href="#/home"> | ||
5 | - <li ng-class="{selected: page.curr === 'dashboard'}" | ||
6 | - ng-click="$route.reload()">Home</li> | ||
7 | - </a> | ||
8 | - <a href="#/user"> | ||
9 | - <li ng-class="{selected: page.curr === 'user'}" | ||
10 | - ng-click="$route.reload()">Users</li> | ||
11 | - </a> | ||
12 | - <a href="#/bundle"> | ||
13 | - <li ng-class="{selected: page.curr === 'bundle'}" | ||
14 | - ng-click="$route.reload()">Bundles</li> | ||
15 | - </a> | ||
16 | - </ul> | ||
17 | -</div> |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -angular.module('cordNav', []) | ||
18 | - .directive('nav', function () { | ||
19 | - return { | ||
20 | - restrict: 'E', | ||
21 | - templateUrl: 'app/fw/nav/nav.html' | ||
22 | - }; | ||
23 | - }); |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -div#bundle div.main-left { | ||
18 | - width: 61%; | ||
19 | - padding: 4% 0 0 1%; | ||
20 | -} | ||
21 | -div#bundle div.main-right { | ||
22 | - width: 37%; | ||
23 | - padding-top: 4%; | ||
24 | -} | ||
25 | - | ||
26 | -#bundle table { | ||
27 | - width: 95%; | ||
28 | - margin-top: 5%; | ||
29 | - margin-left: 2%; | ||
30 | - border-radius: 3px; | ||
31 | -} | ||
32 | - | ||
33 | -#bundle td { | ||
34 | - font-size: 90%; | ||
35 | -} | ||
36 | -#bundle td.icon { | ||
37 | - text-align: center; | ||
38 | - width: 50px; | ||
39 | - height: 50px; | ||
40 | - padding: 4%; | ||
41 | -} | ||
42 | -#bundle td.name { | ||
43 | - border-left: solid 1px rgba(136, 0, 0, 0.25); | ||
44 | - padding-left: 3%; | ||
45 | -} | ||
46 | -#bundle td.desc { | ||
47 | - width: 60%; | ||
48 | - text-align: left; | ||
49 | - font-style: italic; | ||
50 | -} | ||
51 | -/* animation specific */ | ||
52 | -#bundle tr.fadein.ng-leave td.name, | ||
53 | -#bundle tr.fadein.ng-leave-active td.name { | ||
54 | - opacity: 0; | ||
55 | - border: none; | ||
56 | -} | ||
57 | - | ||
58 | -#bundle img { | ||
59 | - width: 100%; | ||
60 | -} | ||
61 | - | ||
62 | -#bundle h2 { | ||
63 | - text-align: center; | ||
64 | - padding: 3%; | ||
65 | - font-weight: lighter; | ||
66 | - border: 1px solid #3C3C3C; | ||
67 | - cursor: pointer; | ||
68 | -} | ||
69 | -#bundle h2:hover { | ||
70 | - color: #CE5650; | ||
71 | - border-color: #CE5650; | ||
72 | -} | ||
73 | - | ||
74 | -div#bundles { | ||
75 | - position: relative; | ||
76 | -} | ||
77 | - | ||
78 | -div#available.ng-hide-add.ng-hide-add-active, | ||
79 | -div#available.ng-hide-remove.ng-hide-remove-active { | ||
80 | - -webkit-transition: all linear 0.5s; | ||
81 | - transition: all linear 0.5s; | ||
82 | -} | ||
83 | -div#available.ng-hide { | ||
84 | - opacity: 0; | ||
85 | - top: -80px; | ||
86 | -} | ||
87 | - | ||
88 | -div#available { | ||
89 | - position: absolute; | ||
90 | - padding: 5%; | ||
91 | - opacity: 1; | ||
92 | - top: -10px; | ||
93 | - width: 100%; | ||
94 | -} | ||
95 | - | ||
96 | -#available p { | ||
97 | - text-indent: initial; | ||
98 | - text-align: initial; | ||
99 | -} | ||
100 | - | ||
101 | -#available button { | ||
102 | - float: right; | ||
103 | - width: 33%; | ||
104 | - margin-top: 5%; | ||
105 | -} |
1 | -<!-- Bundle page partial html --> | ||
2 | -<div id="bundle" class="container"> | ||
3 | - <div class="main-left"> | ||
4 | - <h4>You are subscribed to the</h4> | ||
5 | - <h3>{{name}}</h3> | ||
6 | - <p>{{desc}}</p> | ||
7 | - <table> | ||
8 | - <tr ng-repeat="func in funcs" class="fadein"> | ||
9 | - <td class="icon"> | ||
10 | - <img ng-src="{{'/imgs/' + func.id + '.png'}}"> | ||
11 | - </td> | ||
12 | - <td class="name">{{func.name}}</td> | ||
13 | - <td class="desc">{{func.desc}}</td> | ||
14 | - </tr> | ||
15 | - </table> | ||
16 | - </div> | ||
17 | - <div class="main-right"> | ||
18 | - <img src="imgs/bundle.jpg"> | ||
19 | - <div ng-click="showBundles()"> | ||
20 | - <h2>Available Bundles</h2> | ||
21 | - </div> | ||
22 | - <div id="bundles" bundle-available></div> | ||
23 | - </div> | ||
24 | -</div> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -(function () { | ||
18 | - 'use strict'; | ||
19 | - | ||
20 | - var urlSuffix = '/rs/bundle'; | ||
21 | - | ||
22 | - var basic = 'basic', | ||
23 | - family = 'family'; | ||
24 | - | ||
25 | - angular.module('cordBundle', []) | ||
26 | - .controller('CordBundleCtrl', ['$log', '$scope', '$resource', | ||
27 | - function ($log, $scope, $resource) { | ||
28 | - var BundleData, resource, | ||
29 | - getData; | ||
30 | - $scope.page.curr = 'bundle'; | ||
31 | - $scope.show = false; | ||
32 | - | ||
33 | - getData = function (id) { | ||
34 | - if (!id) { id = ''; } | ||
35 | - | ||
36 | - BundleData = $resource($scope.shared.url + urlSuffix + '/' + id); | ||
37 | - resource = BundleData.get({}, | ||
38 | - // success | ||
39 | - function () { | ||
40 | - var current, availId; | ||
41 | - current = resource.bundle.id; | ||
42 | - $scope.name = resource.bundle.name; | ||
43 | - $scope.desc = resource.bundle.desc; | ||
44 | - $scope.funcs = resource.bundle.functions; | ||
45 | - | ||
46 | - availId = (current === basic) ? family : basic; | ||
47 | - resource.bundles.forEach(function (bundle) { | ||
48 | - if (bundle.id === availId) { | ||
49 | - $scope.available = bundle; | ||
50 | - } | ||
51 | - }); | ||
52 | - }, | ||
53 | - // error | ||
54 | - function () { | ||
55 | - $log.error('Problem with resource', resource); | ||
56 | - }); | ||
57 | - }; | ||
58 | - | ||
59 | - getData(); | ||
60 | - | ||
61 | - $scope.changeBundle = function (id) { | ||
62 | - getData(id); | ||
63 | - }; | ||
64 | - | ||
65 | - $scope.showBundles = function () { | ||
66 | - $scope.show = !$scope.show; | ||
67 | - }; | ||
68 | - | ||
69 | - $log.debug('Cord Bundle Ctrl has been created.'); | ||
70 | - }]) | ||
71 | - | ||
72 | - .directive('bundleAvailable', [function () { | ||
73 | - return { | ||
74 | - templateUrl: 'app/view/bundle/available.html' | ||
75 | - }; | ||
76 | - }]); | ||
77 | -}()); |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -[ng\:cloak], [ng-cloak], .ng-cloak { | ||
18 | - display: none !important; | ||
19 | -} | ||
20 | - | ||
21 | -html, body, div#frame, div#view { | ||
22 | - height: 100%; | ||
23 | -} | ||
24 | - | ||
25 | -head, body, footer, | ||
26 | -h1, h2, h3, h4, h5, h6, p, | ||
27 | -a, ul, li, div, | ||
28 | -table, tr, td, th, thead, tbody, | ||
29 | -form, select, input, option, label { | ||
30 | - padding: 0; | ||
31 | - margin: 0; | ||
32 | -} | ||
33 | - | ||
34 | -h1, h2, h3, h4, h5, h6, | ||
35 | -p, a, li, th, td, | ||
36 | -select, input, option, label { | ||
37 | - font-family: sans-serif, "Droid Sans", "Lucida Grande", Arial, Helvetica; | ||
38 | - color: #3C3C3C; | ||
39 | -} | ||
40 | - | ||
41 | -body { | ||
42 | - background-color: white; | ||
43 | - overflow: hidden; | ||
44 | -} | ||
45 | -table { | ||
46 | - border-spacing: 0; | ||
47 | - border-collapse: collapse; | ||
48 | -} | ||
49 | -th, td { | ||
50 | - color: rgba(0, 0, 0, 0.8); | ||
51 | -} | ||
52 | -h3 { | ||
53 | - margin-bottom: 4%; | ||
54 | - font-size: xx-large; | ||
55 | - font-weight: lighter; | ||
56 | -} | ||
57 | -h4 { | ||
58 | - font-size: large; | ||
59 | - font-weight: lighter; | ||
60 | -} | ||
61 | -h5 { | ||
62 | - color: rgb(107, 107, 107); | ||
63 | - font-style: italic; | ||
64 | - font-weight: normal; | ||
65 | - font-size: 90%; | ||
66 | - margin-bottom: 1%; | ||
67 | -} | ||
68 | -p { | ||
69 | - font-size: 100%; | ||
70 | - color: rgba(0,0,0, 0.8); | ||
71 | - text-indent: 20px; | ||
72 | - text-align: justify; | ||
73 | - padding-right: 5%; | ||
74 | -} | ||
75 | -th { | ||
76 | - background-color: #7AB6EA; | ||
77 | - color: white; | ||
78 | - letter-spacing: 0.05em; | ||
79 | - font-weight: lighter; | ||
80 | -} | ||
81 | - | ||
82 | -button, | ||
83 | -input[type="button"], | ||
84 | -input[type="reset"] { | ||
85 | - height: 30px; | ||
86 | - box-shadow: none; | ||
87 | - border: none; | ||
88 | - outline: none; | ||
89 | - cursor: pointer; | ||
90 | - letter-spacing: 0.02em; | ||
91 | - font-size: 14px; | ||
92 | - background-color: lightgray; | ||
93 | - transition: background-color 0.4s; | ||
94 | -} | ||
95 | -button:hover, | ||
96 | -input[type="button"]:hover, | ||
97 | -input[type="reset"]:hover { | ||
98 | - color: white; | ||
99 | - background-color: rgb(122, 188, 229); | ||
100 | -} | ||
101 | - | ||
102 | -button[disabled], | ||
103 | -input[type="button"][disabled], | ||
104 | -input[type="reset"][disabled] { | ||
105 | - background-color: lightgray; | ||
106 | - color: graytext; | ||
107 | -} | ||
108 | - | ||
109 | - | ||
110 | -button[disabled]:hover, | ||
111 | -input[type="button"][disabled]:hover, | ||
112 | -input[type="reset"][disabled]:hover { | ||
113 | - cursor: default; | ||
114 | -} | ||
115 | - | ||
116 | -div.container { | ||
117 | - width: 85%; | ||
118 | - margin: 0 auto; | ||
119 | - min-height: 100%; | ||
120 | -} | ||
121 | -div.main-left, div.main-right { | ||
122 | - float: left; | ||
123 | -} | ||
124 | -div.main-left { | ||
125 | - width: 37%; | ||
126 | - padding-left: 1%; | ||
127 | -} | ||
128 | -div.main-right { | ||
129 | - width: 61%; | ||
130 | -} | ||
131 | - | ||
132 | -svg#icon-defs { | ||
133 | - display: none; | ||
134 | -} | ||
135 | - | ||
136 | -g.icon circle { | ||
137 | - fill: none; | ||
138 | -} | ||
139 | -g.icon use.glyph.checkMark { | ||
140 | - fill: rgb(68, 189, 83) | ||
141 | -} | ||
142 | -g.icon use.glyph.xMark { | ||
143 | - fill: #CE5650; | ||
144 | -} | ||
145 | - | ||
146 | -th.user-pic { | ||
147 | - background-color: white; | ||
148 | -} | ||
149 | -th.user-pic, | ||
150 | -td.user-pic { | ||
151 | - width: 30px; | ||
152 | - padding-left: 4%; | ||
153 | -} | ||
154 | -td.user-pic img { | ||
155 | - width: 25px; | ||
156 | -} | ||
157 | - | ||
158 | -/* animation */ | ||
159 | -.fadein { | ||
160 | - transition: all linear 0.5s; | ||
161 | -} | ||
162 | -.fadein.ng-enter-stagger, | ||
163 | -.fadein.ng-leave-stagger { | ||
164 | - transition-delay: 0.2s; | ||
165 | - animation-delay: 0.2s; | ||
166 | -} | ||
167 | -.fadein.ng-enter { | ||
168 | - opacity: 0; | ||
169 | -} | ||
170 | -.fadein.ng-enter.ng-enter-active { | ||
171 | - opacity: 1; | ||
172 | -} | ||
173 | -.fadein.ng-leave, | ||
174 | -.fadein.ng-leave-active { | ||
175 | - opacity: 0; | ||
176 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -#home div.main-left { | ||
18 | - width: 55%; | ||
19 | - padding: 0; | ||
20 | -} | ||
21 | -#home div.main-right { | ||
22 | - padding: 1% 0 0 3%; | ||
23 | - width: 42%; | ||
24 | -} | ||
25 | -#home div.move-down { | ||
26 | - margin-top: 5%; | ||
27 | -} | ||
28 | - | ||
29 | -#home div.image-holder { | ||
30 | - width: 100%; | ||
31 | - position: relative; | ||
32 | -} | ||
33 | - | ||
34 | -#home div.main-left img { | ||
35 | - width: 100%; | ||
36 | -} | ||
37 | - | ||
38 | -#home div.main-right div.bundle-title { | ||
39 | - padding: 2% 0; | ||
40 | -} | ||
41 | - | ||
42 | -#home h4 { | ||
43 | - padding-bottom: 2%; | ||
44 | -} | ||
45 | - | ||
46 | -#home p { | ||
47 | - margin-bottom: 3%; | ||
48 | -} | ||
49 | - | ||
50 | -#home table { | ||
51 | - width: 94%; | ||
52 | - table-layout: fixed; | ||
53 | - margin-left: 6%; | ||
54 | - border-left: 1px solid #CE5650; | ||
55 | -} | ||
56 | - | ||
57 | -#home table.users th, | ||
58 | -#home table.users td { | ||
59 | - font-size: 90%; | ||
60 | -} | ||
61 | - | ||
62 | -#home td, #home th { | ||
63 | - text-align: left; | ||
64 | - padding: 2%; | ||
65 | -} |
1 | -<!-- Home page partial html --> | ||
2 | -<div id="home" class="container"> | ||
3 | - <div class="main-left"> | ||
4 | - <img src="/imgs/home.jpg"> | ||
5 | - </div> | ||
6 | - | ||
7 | - <div class="main-right"> | ||
8 | - <div class="move-down"> | ||
9 | - <div class="bundle-title"> | ||
10 | - <h4>Welcome Dad!</h4> | ||
11 | - <h5>You are subscribed to the</h5> | ||
12 | - <h3>{{bundle_name}}</h3> | ||
13 | - </div> | ||
14 | - | ||
15 | - <p>{{bundle_desc}}</p> | ||
16 | - | ||
17 | - | ||
18 | - <h4>Users</h4> | ||
19 | - <table class="users"> | ||
20 | - <thead> | ||
21 | - <tr> | ||
22 | - <th class="user-pic"></th> | ||
23 | - <th>Name</th> | ||
24 | - <th>Last Login</th> | ||
25 | - </tr> | ||
26 | - </thead> | ||
27 | - <tbody> | ||
28 | - | ||
29 | - <tr ng-repeat="user in users" class="fadein"> | ||
30 | - <td class="user-pic"> | ||
31 | - <img ng-src="{{'/imgs/' + user.icon_id + '.jpg'}}"> | ||
32 | - </td> | ||
33 | - <td>{{user.name}}</td> | ||
34 | - <td>{{shared.userActivity[user.id]}}</td> | ||
35 | - </tr> | ||
36 | - </tbody> | ||
37 | - </table> | ||
38 | - </div> | ||
39 | - </div> | ||
40 | -</div> |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -(function () { | ||
18 | - 'use strict'; | ||
19 | - | ||
20 | - var urlSuffix = '/rs/dashboard'; | ||
21 | - | ||
22 | - function randomDate(start, end) { | ||
23 | - return new Date( | ||
24 | - start.getTime() + Math.random() * (end.getTime() - start.getTime()) | ||
25 | - ); | ||
26 | - } | ||
27 | - | ||
28 | - angular.module('cordHome', []) | ||
29 | - .controller('CordHomeCtrl', ['$log', '$scope', '$resource', '$filter', | ||
30 | - function ($log, $scope, $resource, $filter) { | ||
31 | - var DashboardData, resource; | ||
32 | - $scope.page.curr = 'dashboard'; | ||
33 | - | ||
34 | - DashboardData = $resource($scope.shared.url + urlSuffix); | ||
35 | - resource = DashboardData.get({}, | ||
36 | - // success | ||
37 | - function () { | ||
38 | - $scope.bundle_name = resource.bundle_name; | ||
39 | - $scope.bundle_desc = resource.bundle_desc; | ||
40 | - $scope.users = resource.users; | ||
41 | - | ||
42 | - if ($.isEmptyObject($scope.shared.userActivity)) { | ||
43 | - $scope.users.forEach(function (user) { | ||
44 | - var date = randomDate(new Date(2015, 0, 1), | ||
45 | - new Date()); | ||
46 | - | ||
47 | - $scope.shared.userActivity[user.id] = | ||
48 | - $filter('date')(date, 'mediumTime'); | ||
49 | - }); | ||
50 | - } | ||
51 | - }, | ||
52 | - // error | ||
53 | - function () { | ||
54 | - $log.error('Problem with resource', resource); | ||
55 | - }); | ||
56 | - $log.debug('Resource received:', resource); | ||
57 | - | ||
58 | - $log.debug('Cord Home Ctrl has been created.'); | ||
59 | - }]); | ||
60 | -}()); |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -div#login { | ||
18 | - background: url("/imgs/login.jpg") no-repeat center; | ||
19 | - background-size: contain; | ||
20 | - position: absolute; | ||
21 | - top: 3%; | ||
22 | - left: 5%; | ||
23 | -} | ||
24 | - | ||
25 | -div#login-wrapper { | ||
26 | - text-align: center; | ||
27 | -} | ||
28 | - | ||
29 | -#login h2 { | ||
30 | - margin: 1%; | ||
31 | - color: rgb(115, 115, 115); | ||
32 | - font-size: xx-large; | ||
33 | - font-weight: lighter; | ||
34 | - text-align: left; | ||
35 | - position: absolute; | ||
36 | - top: -140px; | ||
37 | -} | ||
38 | - | ||
39 | -div#login-form { | ||
40 | - display: inline-block; | ||
41 | -} | ||
42 | - | ||
43 | -#login div.outline { | ||
44 | - position: absolute; | ||
45 | - border: 1px solid rgba(115, 115, 115, 0.7); | ||
46 | - background-color: white; | ||
47 | - opacity: .6; | ||
48 | - top: -160px; | ||
49 | - left: -25px; | ||
50 | - width: 300px; | ||
51 | - height: 245px; | ||
52 | - border-radius: 1px; | ||
53 | -} | ||
54 | - | ||
55 | -div#login-form { | ||
56 | - margin-left: 2.5%; | ||
57 | - position: relative; | ||
58 | - width: 255px; | ||
59 | - margin-top: 33.5%; | ||
60 | -} | ||
61 | - | ||
62 | -#login-form form { | ||
63 | - line-height: 250%; | ||
64 | -} | ||
65 | - | ||
66 | -#login-form input { | ||
67 | - display: block; | ||
68 | - height: 40px; | ||
69 | - width: 230px; | ||
70 | - font-size: 19px; | ||
71 | - padding: 0 5px; | ||
72 | - margin-bottom: 3.5%; | ||
73 | - border-radius: 1px; | ||
74 | - position: absolute; | ||
75 | -} | ||
76 | -#login-form input[type="text"] { | ||
77 | - top: -90px; | ||
78 | -} | ||
79 | -#login-form input[type="password"] { | ||
80 | - top: -35px; | ||
81 | -} | ||
82 | - | ||
83 | -#login-form input[type="text"], | ||
84 | -#login-form input[type="password"] { | ||
85 | - border: 2px solid rgba(115, 115, 115, 0.7); | ||
86 | - transition: border 0.1s; | ||
87 | -} | ||
88 | -#login-form input[type="text"]:focus, | ||
89 | -#login-form input[type="password"]:focus, | ||
90 | -#login-form input[type="button"]:focus { | ||
91 | - outline: none; | ||
92 | - border: solid 2px rgba(122, 188, 229, 0.5); | ||
93 | -} | ||
94 | - | ||
95 | -#login-form a { | ||
96 | - text-decoration: none; | ||
97 | -} | ||
98 | - | ||
99 | -#login-form input[type="button"] { | ||
100 | - top: 25px; | ||
101 | - width: 245px; | ||
102 | - height: 30px; | ||
103 | - cursor: pointer; | ||
104 | - letter-spacing: 0.02em; | ||
105 | - font-size: 100%; | ||
106 | - color: #3C3C3C; | ||
107 | - background-color: lightgray; | ||
108 | - transition: background-color 0.4s; | ||
109 | -} | ||
110 | - | ||
111 | -#login-form input[type="button"]:hover { | ||
112 | - color: white; | ||
113 | - background-color: rgb(122, 188, 229); | ||
114 | -} | ||
115 | - | ||
116 | -#login-form input.ng-invalid.ng-touched { | ||
117 | - background-color: #CE5650; | ||
118 | - color: white; | ||
119 | -} |
1 | -<!-- Login page partial html --> | ||
2 | -<div id="login" class="container"> | ||
3 | - <div id="login-wrapper"> | ||
4 | - <div id="login-form"> | ||
5 | - <div class="outline"></div> | ||
6 | - <h2>Subscriber Portal</h2> | ||
7 | - <form> | ||
8 | - <input ng-model="email" type="text" placeholder="email" required> | ||
9 | - <input ng-model="password" type="password" placeholder="password" required> | ||
10 | - <input ng-click="login()" type="button" value="Log In"> | ||
11 | - </form> | ||
12 | - </div> | ||
13 | - </div> | ||
14 | -</div> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -(function () { | ||
18 | - 'use strict'; | ||
19 | - var urlSuffix = '/rs/login'; | ||
20 | - | ||
21 | - angular.module('cordLogin', []) | ||
22 | - .controller('CordLoginCtrl', | ||
23 | - ['$log', '$scope', '$resource', '$location', '$window', | ||
24 | - function ($log, $scope, $resource, $location, $window) { | ||
25 | - var LoginData, resource; | ||
26 | - $scope.page.curr = 'login'; | ||
27 | - | ||
28 | - function getResource(email) { | ||
29 | - LoginData = $resource($scope.shared.url + urlSuffix + '/' + email); | ||
30 | - resource = LoginData.get({}, | ||
31 | - function () { | ||
32 | - $location.url('/home'); | ||
33 | - $window.location.href = $location.absUrl(); | ||
34 | - }); | ||
35 | - } | ||
36 | - | ||
37 | - $scope.login = function () { | ||
38 | - if ($scope.email && $scope.password) { | ||
39 | - getResource($scope.email); | ||
40 | - $scope.shared.login = $scope.email; | ||
41 | - } | ||
42 | - }; | ||
43 | - | ||
44 | - $log.debug('Cord Login Ctrl has been created.'); | ||
45 | - }]); | ||
46 | -}()); |
1 | -<!--Partial HTML for rating panel directive--> | ||
2 | -<div id="rating-panel"> | ||
3 | - <div ng-cloak class="ng-hide ng-cloak panel" ng-show="ratingsShown"> | ||
4 | - <table> | ||
5 | - <tr> | ||
6 | - <th class="title">Category</th> | ||
7 | - <th ng-repeat="rating in level_order">{{rating}}</th> | ||
8 | - </tr> | ||
9 | - <tr ng-repeat="cat in category_order"> | ||
10 | - <td class="title">{{cat}}</td> | ||
11 | - <td ng-repeat="r in level_order"> | ||
12 | - <div ng-if="prohibitedSites[r][cat]"> | ||
13 | - <icon size="15" id="xMark"></icon> | ||
14 | - </div> | ||
15 | - <div ng-if="!prohibitedSites[r][cat]"> | ||
16 | - <icon size="15" id="checkMark"></icon> | ||
17 | - </div> | ||
18 | - </td> | ||
19 | - </tr> | ||
20 | - </table> | ||
21 | - </div> | ||
22 | -</div> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -#user div { | ||
18 | - padding-top: 2%; | ||
19 | -} | ||
20 | - | ||
21 | -#user div.main-left { | ||
22 | - width: 98%; | ||
23 | - padding-left: 1%; | ||
24 | -} | ||
25 | -#user div.main-left.family { | ||
26 | - width: 62%; | ||
27 | - padding-left: 1%; | ||
28 | -} | ||
29 | - | ||
30 | -#user div.main-right { | ||
31 | - width: 0; | ||
32 | -} | ||
33 | -#user div.main-right.family { | ||
34 | - width: 37%; | ||
35 | -} | ||
36 | - | ||
37 | -#user table.user-info, | ||
38 | -#user table.user-form { | ||
39 | - float: left; | ||
40 | - width: 100%; | ||
41 | -} | ||
42 | - | ||
43 | -#user table.user-info th, | ||
44 | -#user table.user-form th { | ||
45 | - text-align: left; | ||
46 | - padding: 2% 1%; | ||
47 | -} | ||
48 | - | ||
49 | -#user span.help:hover { | ||
50 | - cursor: pointer; | ||
51 | - color: #CE5650; | ||
52 | -} | ||
53 | - | ||
54 | -#user div.main-left.family table.user-info th, | ||
55 | -#user div.main-right.family table.user-form th { | ||
56 | - padding: 17px; | ||
57 | -} | ||
58 | - | ||
59 | -#user div.main-left.family table.user-info td, | ||
60 | -#user div.main-right.family table.user-form td { | ||
61 | - padding: 10px; | ||
62 | - height: 23px; | ||
63 | -} | ||
64 | -#user table.user-info td { | ||
65 | - padding: 1%; | ||
66 | -} | ||
67 | - | ||
68 | -#user table.user-form td { | ||
69 | - border-left: 1px solid #CE5650; | ||
70 | -} | ||
71 | - | ||
72 | -#user table.user-form td.buttons { | ||
73 | - text-align: right; | ||
74 | - border: none; | ||
75 | -} | ||
76 | - | ||
77 | -#user table.user-form tr.options td { | ||
78 | - padding-left: 5%; | ||
79 | -} | ||
80 | - | ||
81 | -#user select, | ||
82 | -#user select:focus { | ||
83 | - border: none; | ||
84 | -} | ||
85 | - | ||
86 | -#user select { | ||
87 | - font-size: 95%; | ||
88 | -} | ||
89 | - | ||
90 | -#user option, | ||
91 | -#user option:focus { | ||
92 | - border: none; | ||
93 | -} | ||
94 | - | ||
95 | -#user option[selected] { | ||
96 | - background-color: rgb(122, 188, 229); | ||
97 | -} | ||
98 | - | ||
99 | -#user label { | ||
100 | - font-weight: bold; | ||
101 | - display: block; | ||
102 | - text-align: center; | ||
103 | - padding: 5%; | ||
104 | -} | ||
105 | - | ||
106 | -#user input[type="button"], | ||
107 | -#user input[type="reset"] { | ||
108 | - width: 30%; | ||
109 | -} | ||
110 | - | ||
111 | -#user td.buttons div { | ||
112 | - display: inline; | ||
113 | -} | ||
114 | -#user td.buttons svg { | ||
115 | - vertical-align: middle; | ||
116 | -} | ||
117 | - | ||
118 | -#rating-panel th, | ||
119 | -#rating-panel td { | ||
120 | - text-align: center; | ||
121 | - padding: 1%; | ||
122 | - font-weight: lighter; | ||
123 | -} | ||
124 | - | ||
125 | -#rating-panel th.title, | ||
126 | -#rating-panel td.title { | ||
127 | - width: 125px; | ||
128 | - text-align: left; | ||
129 | -} | ||
130 | - | ||
131 | -#rating-panel th { | ||
132 | - background-color: white; | ||
133 | - padding-top: 3%; | ||
134 | - border-bottom: 1px solid #CE5650; | ||
135 | - color: #3C3C3C; | ||
136 | - font-weight: normal; | ||
137 | -} | ||
138 | - | ||
139 | -#rating-panel tr th:first-child, | ||
140 | -#rating-panel tr td:first-child { | ||
141 | - padding-left: 5%; | ||
142 | -} | ||
143 | -#rating-panel tr th:last-child, | ||
144 | -#rating-panel tr td:last-child { | ||
145 | - padding-right: 5%; | ||
146 | -} | ||
147 | - | ||
148 | -div#rating-panel { | ||
149 | - position: relative; | ||
150 | - pointer-events: none; | ||
151 | -} | ||
152 | - | ||
153 | -#rating-panel div.ng-hide-add.ng-hide-add-active, | ||
154 | -#rating-panel div.ng-hide-remove.ng-hide-remove-active { | ||
155 | - -webkit-transition: all linear 0.75s; | ||
156 | - transition: all linear 0.75s; | ||
157 | -} | ||
158 | - | ||
159 | -#rating-panel div.panel { | ||
160 | - position: absolute; | ||
161 | - top: 0; | ||
162 | - left: -6%; | ||
163 | - height: 545px; | ||
164 | - overflow: auto; | ||
165 | - padding: 0; | ||
166 | - pointer-events: auto; | ||
167 | - box-shadow: 0 3px 23px 7px rgb(118, 118, 118); | ||
168 | - border-radius: 3px; | ||
169 | -} | ||
170 | -#rating-panel table { | ||
171 | - table-layout: fixed; | ||
172 | - width: 500px; | ||
173 | - background-color: white; | ||
174 | - opacity: 1; | ||
175 | -} | ||
176 | - | ||
177 | -#rating-panel div.ng-hide { | ||
178 | - opacity: 0; | ||
179 | - left: -55%; | ||
180 | -} |
1 | -<!-- Users page partial html --> | ||
2 | -<div class="container"> | ||
3 | - <div id="user"> | ||
4 | - <div class="main-left" ng-class="{family: isFamily}"> | ||
5 | - <table class="user-info"> | ||
6 | - <tr> | ||
7 | - <th class="user-pic"></th> | ||
8 | - <th>Name</th> | ||
9 | - <th>Last Login</th> | ||
10 | - </tr> | ||
11 | - <tr ng-repeat="user in users" class="fadein"> | ||
12 | - <td class="user-pic"> | ||
13 | - <img ng-src="{{'/imgs/' + user.icon_id + '.jpg'}}"> | ||
14 | - </td> | ||
15 | - <td>{{user.name}}</td> | ||
16 | - <td>{{shared.userActivity[user.id]}}</td> | ||
17 | - </tr> | ||
18 | - </table> | ||
19 | - </div> | ||
20 | - | ||
21 | - <div class="main-right" ng-class="{family: isFamily}"> | ||
22 | - <form ng-if="isFamily" | ||
23 | - name="changeLevels"> | ||
24 | - <table class="user-form"> | ||
25 | - <tr> | ||
26 | - <th> | ||
27 | - Select Site Rating | ||
28 | - <span class="help" | ||
29 | - ng-click="showRatings()"> (?)</span> | ||
30 | - </th> | ||
31 | - </tr> | ||
32 | - <tr ng-repeat="user in users" class="options"> | ||
33 | - <td> | ||
34 | - <select ng-init="newLevels[user.id]=user.profile.url_filter.level" | ||
35 | - ng-model="newLevels[user.id]" | ||
36 | - ng-options="l for l in levels"> | ||
37 | - </select> | ||
38 | - </td> | ||
39 | - </tr> | ||
40 | - <tr> | ||
41 | - <td class="buttons"> | ||
42 | - <div ng-show="showCheck"> | ||
43 | - <icon size="20px" id="checkMark"></icon> | ||
44 | - </div> | ||
45 | - <input type="reset" value="Cancel" | ||
46 | - ng-click="cancelChanges(changeLevels)" | ||
47 | - ng-disabled="changeLevels.$pristine"> | ||
48 | - <input type="button" value="Apply" | ||
49 | - ng-click="applyChanges(changeLevels)" | ||
50 | - ng-disabled="changeLevels.$pristine"> | ||
51 | - </td> | ||
52 | - </tr> | ||
53 | - </table> | ||
54 | - </form> | ||
55 | - </div> | ||
56 | - <div ng-if="isFamily"> | ||
57 | - <ratings-panel></ratings-panel> | ||
58 | - </div> | ||
59 | - </div> | ||
60 | -</div> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -(function () { | ||
18 | - 'use strict'; | ||
19 | - | ||
20 | - var bundleUrlSuffix = '/rs/bundle', | ||
21 | - userUrlSuffix = '/rs/users', | ||
22 | - family = 'family', | ||
23 | - url_filter = 'url_filter'; | ||
24 | - | ||
25 | - angular.module('cordUser', []) | ||
26 | - .controller('CordUserCtrl', ['$log', '$scope', '$resource', '$timeout', | ||
27 | - function ($log, $scope, $resource, $timeout) { | ||
28 | - var BundleData, bundleResource; | ||
29 | - $scope.page.curr = 'user'; | ||
30 | - $scope.isFamily = false; | ||
31 | - $scope.newLevels = {}; | ||
32 | - $scope.showCheck = false; | ||
33 | - $scope.ratingsShown = false; | ||
34 | - | ||
35 | - // === Get data functions --- | ||
36 | - | ||
37 | - BundleData = $resource($scope.shared.url + bundleUrlSuffix); | ||
38 | - bundleResource = BundleData.get({}, | ||
39 | - // success | ||
40 | - function () { | ||
41 | - var result; | ||
42 | - $scope.isFamily = (bundleResource.bundle.id === family); | ||
43 | - if ($scope.isFamily) { | ||
44 | - result = $.grep( | ||
45 | - bundleResource.bundle.functions, | ||
46 | - function (elem) { | ||
47 | - if (elem.id === url_filter) { return true; } | ||
48 | - } | ||
49 | - ); | ||
50 | - $scope.levels = result[0].params.levels; | ||
51 | - } | ||
52 | - }, | ||
53 | - // error | ||
54 | - function () { | ||
55 | - $log.error('Problem with resource', bundleResource); | ||
56 | - } | ||
57 | - ); | ||
58 | - | ||
59 | - function getUsers(url) { | ||
60 | - var UserData, userResource; | ||
61 | - UserData = $resource(url); | ||
62 | - userResource = UserData.get({}, | ||
63 | - // success | ||
64 | - function () { | ||
65 | - $scope.users = userResource.users; | ||
66 | - }, | ||
67 | - // error | ||
68 | - function () { | ||
69 | - $log.error('Problem with resource', userResource); | ||
70 | - } | ||
71 | - ); | ||
72 | - } | ||
73 | - | ||
74 | - getUsers($scope.shared.url + userUrlSuffix); | ||
75 | - | ||
76 | - // === Form functions --- | ||
77 | - | ||
78 | - function levelUrl(id, level) { | ||
79 | - return $scope.shared.url + | ||
80 | - userUrlSuffix + '/' + id + '/apply/url_filter/level/' + level; | ||
81 | - } | ||
82 | - | ||
83 | - $scope.applyChanges = function (changeLevels) { | ||
84 | - var requests = []; | ||
85 | - | ||
86 | - if ($scope.users) { | ||
87 | - $.each($scope.users, function (index, user) { | ||
88 | - var id = user.id, | ||
89 | - level = user.profile.url_filter.level; | ||
90 | - if ($scope.newLevels[id] !== level) { | ||
91 | - requests.push(levelUrl(id, $scope.newLevels[id])); | ||
92 | - } | ||
93 | - }); | ||
94 | - | ||
95 | - $.each(requests, function (index, req) { | ||
96 | - getUsers(req); | ||
97 | - }); | ||
98 | - } | ||
99 | - changeLevels.$setPristine(); | ||
100 | - $scope.showCheck = true; | ||
101 | - $timeout(function () { | ||
102 | - $scope.showCheck = false; | ||
103 | - }, 3000); | ||
104 | - }; | ||
105 | - | ||
106 | - $scope.cancelChanges = function (changeLevels) { | ||
107 | - if ($scope.users) { | ||
108 | - $.each($scope.users, function (index, user) { | ||
109 | - $scope.newLevels[user.id] = user.profile.url_filter.level; | ||
110 | - }); | ||
111 | - } | ||
112 | - changeLevels.$setPristine(); | ||
113 | - $scope.showCheck = false; | ||
114 | - }; | ||
115 | - | ||
116 | - $scope.showRatings = function () { | ||
117 | - $scope.ratingsShown = !$scope.ratingsShown; | ||
118 | - }; | ||
119 | - | ||
120 | - $log.debug('Cord User Ctrl has been created.'); | ||
121 | - }]) | ||
122 | - | ||
123 | - .directive('ratingsPanel', ['$log', function ($log) { | ||
124 | - return { | ||
125 | - templateUrl: 'app/view/user/ratingPanel.html', | ||
126 | - link: function (scope, elem, attrs) { | ||
127 | - function fillSubMap(order, bool) { | ||
128 | - var result = {}; | ||
129 | - $.each(order, function (index, cat) { | ||
130 | - result[cat] = bool; | ||
131 | - }); | ||
132 | - return result; | ||
133 | - } | ||
134 | - function processSubMap(prhbSites) { | ||
135 | - var result = {}; | ||
136 | - $.each(prhbSites, function (index, cat) { | ||
137 | - result[cat] = true; | ||
138 | - }); | ||
139 | - return result; | ||
140 | - } | ||
141 | - | ||
142 | - function preprocess(data, order) { | ||
143 | - return { | ||
144 | - ALL: fillSubMap(order, false), | ||
145 | - G: processSubMap(data.G), | ||
146 | - PG: processSubMap(data.PG), | ||
147 | - PG_13: processSubMap(data.PG_13), | ||
148 | - R: processSubMap(data.R), | ||
149 | - NONE: fillSubMap(order, true) | ||
150 | - }; | ||
151 | - } | ||
152 | - | ||
153 | - $.getJSON('/app/data/pc_cats.json', function (data) { | ||
154 | - scope.level_order = data.level_order; | ||
155 | - scope.category_order = data.category_order; | ||
156 | - scope.prohibitedSites = preprocess( | ||
157 | - data.prohibited, data.category_order | ||
158 | - ); | ||
159 | - scope.$apply(); | ||
160 | - }); | ||
161 | - } | ||
162 | - }; | ||
163 | - }]); | ||
164 | - | ||
165 | -}()); |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -(function () { | ||
18 | - 'use strict'; | ||
19 | - | ||
20 | - var modules = [ | ||
21 | - 'ngRoute', | ||
22 | - 'ngResource', | ||
23 | - 'ngAnimate', | ||
24 | - 'cordMast', | ||
25 | - 'cordFoot', | ||
26 | - 'cordNav' | ||
27 | - ], | ||
28 | - viewIds = [ | ||
29 | - 'login', | ||
30 | - 'home', | ||
31 | - 'user', | ||
32 | - 'bundle' | ||
33 | - ], | ||
34 | - viewDependencies = [], | ||
35 | - dependencies; | ||
36 | - | ||
37 | - function capitalize(word) { | ||
38 | - return word ? word[0].toUpperCase() + word.slice(1) : word; | ||
39 | - } | ||
40 | - | ||
41 | - viewIds.forEach(function (id) { | ||
42 | - if (id) { | ||
43 | - viewDependencies.push('cord' + capitalize(id)); | ||
44 | - } | ||
45 | - }); | ||
46 | - | ||
47 | - dependencies = modules.concat(viewDependencies); | ||
48 | - | ||
49 | - angular.module('cordGui', dependencies) | ||
50 | - .config(['$routeProvider', function ($routeProvider) { | ||
51 | - $routeProvider | ||
52 | - .otherwise({ | ||
53 | - redirectTo: '/login' | ||
54 | - }); | ||
55 | - | ||
56 | - function viewCtrlName(vid) { | ||
57 | - return 'Cord' + capitalize(vid) + 'Ctrl'; | ||
58 | - } | ||
59 | - | ||
60 | - function viewTemplateUrl(vid) { | ||
61 | - return 'app/view/' + vid + '/' + vid + '.html'; | ||
62 | - } | ||
63 | - | ||
64 | - viewIds.forEach(function (vid) { | ||
65 | - if (vid) { | ||
66 | - $routeProvider.when('/' + vid, { | ||
67 | - controller: viewCtrlName(vid), | ||
68 | - controllerAs: 'ctrl', | ||
69 | - templateUrl: viewTemplateUrl(vid) | ||
70 | - }); | ||
71 | - } | ||
72 | - }); | ||
73 | - }]) | ||
74 | - .controller('CordCtrl', ['$scope', '$location', | ||
75 | - function ($scope, $location) { | ||
76 | - $scope.shared = { | ||
77 | - url: 'http://' + $location.host() + ':' + $location.port(), | ||
78 | - userActivity: {} | ||
79 | - }; | ||
80 | - $scope.page = {}; | ||
81 | - }]); | ||
82 | -}()); |
5.61 KB
211 KB
4.3 MB
332 KB
29.3 KB
289 KB
4.51 MB
29.6 KB
1.09 MB
35.5 KB
307 KB
13 KB
1 | -<!DOCTYPE html> | ||
2 | -<!-- | ||
3 | -~ Copyright 2015-present Open Networking Laboratory | ||
4 | -~ | ||
5 | -~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | -~ you may not use this file except in compliance with the License. | ||
7 | -~ You may obtain a copy of the License at | ||
8 | -~ | ||
9 | -~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | -~ | ||
11 | -~ Unless required by applicable law or agreed to in writing, software | ||
12 | -~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | -~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | -~ See the License for the specific language governing permissions and | ||
15 | -~ limitations under the License. | ||
16 | -~ | ||
17 | ---> | ||
18 | -<html> | ||
19 | -<head> | ||
20 | - <meta charset="utf-8"> | ||
21 | - <link rel="shortcut icon" href="imgs/bird.png"> | ||
22 | - | ||
23 | - <title>CORD Subscriber Portal</title> | ||
24 | - | ||
25 | - <script src="tp/angular.js"></script> | ||
26 | - <script src="tp/angular-route.js"></script> | ||
27 | - <script src="tp/angular-animate.js"></script> | ||
28 | - <script src="tp/angular-resource.js"></script> | ||
29 | - <script src="tp/jquery-2.1.4.js"></script> | ||
30 | - | ||
31 | - <script src="cord.js"></script> | ||
32 | - <link rel="stylesheet" href="app/view/common/common.css"> | ||
33 | - | ||
34 | - <script src="app/fw/mast/mast.js"></script> | ||
35 | - <link rel="stylesheet" href="app/fw/mast/mast.css"> | ||
36 | - <script src="app/fw/foot/foot.js"></script> | ||
37 | - <link rel="stylesheet" href="app/fw/foot/foot.css"> | ||
38 | - | ||
39 | - <script src="app/fw/nav/nav.js"></script> | ||
40 | - <link rel="stylesheet" href="app/fw/nav/nav.css"> | ||
41 | - | ||
42 | - <script src="app/fw/icon/icon.js"></script> | ||
43 | - | ||
44 | - <script src="app/view/login/login.js"></script> | ||
45 | - <link rel="stylesheet" href="app/view/login/login.css"> | ||
46 | - | ||
47 | - <script src="app/view/home/home.js"></script> | ||
48 | - <link rel="stylesheet" href="app/view/home/home.css"> | ||
49 | - | ||
50 | - <script src="app/view/user/user.js"></script> | ||
51 | - <link rel="stylesheet" href="app/view/user/user.css"> | ||
52 | - | ||
53 | - <script src="app/view/bundle/bundle.js"></script> | ||
54 | - <link rel="stylesheet" href="app/view/bundle/bundle.css"> | ||
55 | - | ||
56 | -</head> | ||
57 | -<body ng-app="cordGui"> | ||
58 | -<div id="frame" ng-controller="CordCtrl as cordCtrl"> | ||
59 | - | ||
60 | -<mast></mast> | ||
61 | -<foot></foot> | ||
62 | -<div id="view" ng-view></div> | ||
63 | - | ||
64 | -<svg id="icon-defs"> | ||
65 | - <defs> | ||
66 | - <symbol id="bird" viewBox="352 224 113 112"> | ||
67 | - <path d="M427.7,300.4 c-6.9,0.6-13.1,5-19.2,7.1c-18.1,6.2-33.9, | ||
68 | - 9.1-56.5,4.7c24.6,17.2,36.6,13,63.7,0.1c-0.5,0.6-0.7,1.3-1.3, | ||
69 | - 1.9c1.4-0.4,2.4-1.7,3.4-2.2c-0.4,0.7-0.9,1.5-1.4,1.9c2.2-0.6, | ||
70 | - 3.7-2.3,5.9-3.9c-2.4,2.1-4.2,5-6,8c-1.5,2.5-3.1,4.8-5.1,6.9c-1, | ||
71 | - 1-1.9,1.9-2.9,2.9c-1.4,1.3-2.9,2.5-5.1,2.9c1.7,0.1,3.6-0.3,6.5 | ||
72 | - -1.9c-1.6,2.4-7.1,6.2-9.9,7.2c10.5-2.6,19.2-15.9,25.7-18c18.3 | ||
73 | - -5.9,13.8-3.4,27-14.2c1.6-1.3,3-1,5.1-0.8c1.1,0.1,2.1,0.3,3.2, | ||
74 | - 0.5c0.8,0.2,1.4,0.4,2.2,0.8l1.8,0.9c-1.9-4.5-2.3-4.1-5.9-6c-2.3 | ||
75 | - -1.3-3.3-3.8-6.2-4.9c-7.1-2.6-11.9,11.7-11.7-5c0.1-8,4.2-14.4, | ||
76 | - 6.4-22c1.1-3.8,2.3-7.6,2.4-11.5c0.1-2.3,0-4.7-0.4-7c-2-11.2-8.4 | ||
77 | - -21.5-19.7-24.8c-1-0.3-1.1-0.3-0.9,0c9.6,17.1,7.2,38.3,3.1,54.2 | ||
78 | - C429.9,285.5,426.7,293.2,427.7,300.4z"></path> | ||
79 | - </symbol> | ||
80 | - <symbol id="checkMark" viewBox="0 0 10 10"> | ||
81 | - <path d="M2.6,4.5c0,0,0.7-0.4,1.2,0.3l1.0,1.8c0,0,2.7-5.4,2.8-5.7c | ||
82 | - 0,0,0.5-0.9,1.4-0.1c0,0,0.5,0.5,0,1.3S6.8,7.3,5.6,9.2c0,0-0.4,0.5 | ||
83 | - -1.2,0.1S2.2,5.4,2.2,5.4S2.2,4.7,2.6,4.5z"></path> | ||
84 | - </symbol> | ||
85 | - <symbol id="xMark" viewBox="0 0 10 10"> | ||
86 | - <path d="M9.0,7.2C8.2,6.9,7.4,6.1,6.7,5.2c0.4-0.5,0.7-0.8,0.8-1.0C | ||
87 | - 7.8,3.5,9.4,1.6,8.1,1.1C6.8,0.6,6.6,1.7,6.6,1.7C6.4,2.1,6.0,2.7, | ||
88 | - 5.4,3.4C4.9,2.5,4.5,1.9,4.5,1.9S3.8,0.2,2.9,0.7C1.9,1.1,2.3,2.3, | ||
89 | - 2.3,2.3c0.3,1.1,0.8,2.1,1.4,2.9C2.5,6.4,1.3,7.4,1.3,7.4S0.8,7.8, | ||
90 | - 0.8,8.1C0.9,8.3,0.9,9.6,2.4,9.1C3.1,8.8,4.1,7.9,5.1,7.0c1.3,1.3, | ||
91 | - 2.5,1.9,2.5,1.9s0.5,0.5,1.4-0.2C9.8,7.9,9.0,7.2,9.0,7.2z"></path> | ||
92 | - </symbol> | ||
93 | - </defs> | ||
94 | -</svg> | ||
95 | -</div> | ||
96 | - | ||
97 | -</body> | ||
98 | -</html> |
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 | -cp $ONOS_ROOT/apps/demo/cord-gui/target/cord-gui-1.8.0-SNAPSHOT.war . |
1 | -#######------------------------------------------------------------ | ||
2 | -# CORD Demo | ||
3 | -# ========= | ||
4 | - | ||
5 | -export LISTENPORT=8080 | ||
6 | -export JETTY="-jar jetty-runner.jar" | ||
7 | -export CORD=./cord-gui-1.8.0-SNAPSHOT.war | ||
8 | -export LOGDBG=-Dorg.onosproject.cord.gui.LEVEL=DEBUG | ||
9 | -export DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n" | ||
10 | -export LOG=cord.log | ||
11 | - | ||
12 | -DBG="" | ||
13 | -if [ "$1" = "debug" ] | ||
14 | -then | ||
15 | - shift | ||
16 | - DBG=$DEBUG | ||
17 | -fi | ||
18 | - | ||
19 | -IP="$1" | ||
20 | -PORT="$2" | ||
21 | - | ||
22 | -if [ ! -z "$IP" ] | ||
23 | -then | ||
24 | - PARAM1="-Dheadnodeip=$IP" | ||
25 | -else | ||
26 | - PARAM1="" | ||
27 | -fi | ||
28 | - | ||
29 | -if [ ! -z "$PORT" ] | ||
30 | -then | ||
31 | - PARAM2="-Dheadnodeport=$PORT" | ||
32 | -else | ||
33 | - PARAM2="" | ||
34 | -fi | ||
35 | - | ||
36 | -java $PARAM1 $PARAM2 $LOGDBG $DBG $JETTY --port $LISTENPORT $CORD >$LOG 2>&1 & | ||
37 | - | ||
38 | -echo jetty-runner started {$PARAM1:$PARAM2} | ||
39 | -echo .. logging to $LOG |
1 | -# script to stop the cord gui server | ||
2 | -# | ||
3 | -PID=$(ps -ef | grep jetty-runner | grep -v grep | awk '{print $2}') | ||
4 | -if [ -z "$PID" ] | ||
5 | -then | ||
6 | - echo jetty-runner not running | ||
7 | - exit 0 | ||
8 | -fi | ||
9 | -kill $PID | ||
10 | -sleep 1 | ||
11 | - | ||
12 | -PID=$(ps -ef | grep jetty-runner | grep -v grep | awk '{print $2}') | ||
13 | -if [ ! -z "$PID" ] | ||
14 | -then | ||
15 | - echo jetty-runner still running ? | ||
16 | -else | ||
17 | - echo jetty-runner stopped | ||
18 | -fi |
This diff is collapsed. Click to expand it.
apps/demo/cord-gui/src/test/org/onosproject/cord/gui/model/BundleFactoryTest.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import org.junit.Test; | ||
21 | - | ||
22 | -import java.util.Set; | ||
23 | - | ||
24 | -import static org.junit.Assert.*; | ||
25 | -import static org.onosproject.cord.gui.model.BundleFactory.*; | ||
26 | -import static org.onosproject.cord.gui.model.XosFunctionDescriptor.*; | ||
27 | - | ||
28 | -/** | ||
29 | - * Unit tests for {@link BundleFactory}. | ||
30 | - */ | ||
31 | -public class BundleFactoryTest { | ||
32 | - | ||
33 | - @Test | ||
34 | - public void bundleCount() { | ||
35 | - assertEquals("wrong count", 2, availableBundles().size()); | ||
36 | - assertTrue("missing basic", availableBundles().contains(BASIC_BUNDLE)); | ||
37 | - assertTrue("missing family", availableBundles().contains(FAMILY_BUNDLE)); | ||
38 | - } | ||
39 | - | ||
40 | - @Test | ||
41 | - public void basicBundle() { | ||
42 | - BundleDescriptor bundle = BundleFactory.BASIC_BUNDLE; | ||
43 | - assertEquals("wrong id", "basic", bundle.id()); | ||
44 | - assertEquals("wrong id", "Basic Bundle", bundle.displayName()); | ||
45 | - Set<XosFunctionDescriptor> funcs = bundle.functions(); | ||
46 | - assertTrue("missing internet", funcs.contains(INTERNET)); | ||
47 | - assertTrue("missing firewall", funcs.contains(FIREWALL)); | ||
48 | - assertFalse("unexpected url-f", funcs.contains(URL_FILTER)); | ||
49 | - } | ||
50 | - | ||
51 | - @Test | ||
52 | - public void familyBundle() { | ||
53 | - BundleDescriptor bundle = BundleFactory.FAMILY_BUNDLE; | ||
54 | - assertEquals("wrong id", "family", bundle.id()); | ||
55 | - assertEquals("wrong id", "Family Bundle", bundle.displayName()); | ||
56 | - Set<XosFunctionDescriptor> funcs = bundle.functions(); | ||
57 | - assertTrue("missing internet", funcs.contains(INTERNET)); | ||
58 | - assertTrue("missing firewall", funcs.contains(FIREWALL)); | ||
59 | - assertTrue("missing url-f", funcs.contains(URL_FILTER)); | ||
60 | - } | ||
61 | - | ||
62 | - @Test | ||
63 | - public void bundleFromIdBasic() { | ||
64 | - assertEquals("wrong bundle", BASIC_BUNDLE, bundleFromId("basic")); | ||
65 | - } | ||
66 | - | ||
67 | - @Test | ||
68 | - public void bundleFromIdFamily() { | ||
69 | - assertEquals("wrong bundle", FAMILY_BUNDLE, bundleFromId("family")); | ||
70 | - } | ||
71 | - | ||
72 | - @Test(expected = IllegalArgumentException.class) | ||
73 | - public void bundleFromIdUnknown() { | ||
74 | - bundleFromId("unknown"); | ||
75 | - } | ||
76 | -} | ||
77 | - |
apps/demo/cord-gui/src/test/org/onosproject/cord/gui/model/UrlFilterFunctionTest.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import org.junit.Before; | ||
21 | -import org.junit.Test; | ||
22 | - | ||
23 | -import static org.junit.Assert.assertEquals; | ||
24 | -import static org.junit.Assert.assertTrue; | ||
25 | - | ||
26 | -/** | ||
27 | - * Unit tests for {@link UrlFilterFunction}. | ||
28 | - */ | ||
29 | -public class UrlFilterFunctionTest { | ||
30 | - | ||
31 | - private SubscriberUser user = new SubscriberUser(1, "foo", "fooMAC", "levelX"); | ||
32 | - private UrlFilterFunction fn; | ||
33 | - | ||
34 | - @Before | ||
35 | - public void setUp() { | ||
36 | - fn = new UrlFilterFunction(); | ||
37 | - } | ||
38 | - | ||
39 | - @Test | ||
40 | - public void basic() { | ||
41 | - assertEquals("wrong enum const count", | ||
42 | - 6, UrlFilterFunction.Level.values().length); | ||
43 | - } | ||
44 | - | ||
45 | - @Test | ||
46 | - public void memento() { | ||
47 | - XosFunction.Memento memo = fn.createMemento(); | ||
48 | - assertTrue("wrong class", memo instanceof UrlFilterFunction.UrlFilterMemento); | ||
49 | - UrlFilterFunction.UrlFilterMemento umemo = | ||
50 | - (UrlFilterFunction.UrlFilterMemento) memo; | ||
51 | - assertEquals("wrong default level", "G", umemo.level()); | ||
52 | - } | ||
53 | - | ||
54 | - @Test | ||
55 | - public void memoNewLevel() { | ||
56 | - XosFunction.Memento memo = fn.createMemento(); | ||
57 | - assertTrue("wrong class", memo instanceof UrlFilterFunction.UrlFilterMemento); | ||
58 | - UrlFilterFunction.UrlFilterMemento umemo = | ||
59 | - (UrlFilterFunction.UrlFilterMemento) memo; | ||
60 | - assertEquals("wrong default level", "G", umemo.level()); | ||
61 | - umemo.setLevel(UrlFilterFunction.Level.R); | ||
62 | - assertEquals("wrong new level", "R", umemo.level()); | ||
63 | - } | ||
64 | - | ||
65 | - @Test | ||
66 | - public void applyMemo() { | ||
67 | - UrlFilterFunction.UrlFilterMemento memo = | ||
68 | - (UrlFilterFunction.UrlFilterMemento) fn.createMemento(); | ||
69 | - memo.setLevel(UrlFilterFunction.Level.PG_13); | ||
70 | - user.setMemento(XosFunctionDescriptor.URL_FILTER, memo); | ||
71 | - | ||
72 | - assertEquals("wrong URL suffix", "url_filter/PG_13", fn.xosUrlApply(user)); | ||
73 | - } | ||
74 | -} |
apps/demo/cord-gui/src/test/org/onosproject/cord/gui/model/XosFunctionDescriptorTest.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -package org.onosproject.cord.gui.model; | ||
19 | - | ||
20 | -import org.junit.Test; | ||
21 | - | ||
22 | -import static org.junit.Assert.*; | ||
23 | -import static org.onosproject.cord.gui.model.XosFunctionDescriptor.*; | ||
24 | - | ||
25 | -/** | ||
26 | - * Sanity unit tests for {@link XosFunctionDescriptor}. | ||
27 | - */ | ||
28 | -public class XosFunctionDescriptorTest { | ||
29 | - | ||
30 | - @Test | ||
31 | - public void numberOfFunctions() { | ||
32 | - assertEquals("unexpected constant count", 4, values().length); | ||
33 | - } | ||
34 | - | ||
35 | - @Test | ||
36 | - public void internet() { | ||
37 | - assertEquals("wrong id", "internet", INTERNET.id()); | ||
38 | - assertEquals("wrong display", "Internet", INTERNET.displayName()); | ||
39 | - assertTrue("wrong desc", INTERNET.description().startsWith("Basic")); | ||
40 | - assertFalse("wrong backend", INTERNET.backend()); | ||
41 | - } | ||
42 | - | ||
43 | - @Test | ||
44 | - public void firewall() { | ||
45 | - assertEquals("wrong id", "firewall", FIREWALL.id()); | ||
46 | - assertEquals("wrong display", "Firewall", FIREWALL.displayName()); | ||
47 | - assertTrue("wrong desc", FIREWALL.description().startsWith("Normal")); | ||
48 | - assertTrue("wrong backend", FIREWALL.backend()); | ||
49 | - } | ||
50 | - | ||
51 | - @Test | ||
52 | - public void urlFilter() { | ||
53 | - assertEquals("wrong id", "url_filter", URL_FILTER.id()); | ||
54 | - assertEquals("wrong display", "Parental Control", URL_FILTER.displayName()); | ||
55 | - assertTrue("wrong desc", URL_FILTER.description().startsWith("Variable")); | ||
56 | - assertTrue("wrong backend", URL_FILTER.backend()); | ||
57 | - } | ||
58 | - | ||
59 | - @Test | ||
60 | - public void cdn() { | ||
61 | - assertEquals("wrong id", "cdn", CDN.id()); | ||
62 | - assertEquals("wrong display", "CDN", CDN.displayName()); | ||
63 | - assertTrue("wrong desc", CDN.description().startsWith("Content")); | ||
64 | - assertTrue("wrong backend", CDN.backend()); | ||
65 | - } | ||
66 | -} |
-
Please register or login to post a comment