Base net-virt CLI files on top of which ONOS specific changes will be done
diff --git a/cli/sdncon/apps/cstats/__init__.py b/cli/sdncon/apps/cstats/__init__.py
new file mode 100755
index 0000000..9ab2783
--- /dev/null
+++ b/cli/sdncon/apps/cstats/__init__.py
@@ -0,0 +1,16 @@
+#
+# Copyright (c) 2013 Big Switch Networks, Inc.
+#
+# Licensed under the Eclipse Public License, Version 1.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+
diff --git a/cli/sdncon/apps/cstats/models.py b/cli/sdncon/apps/cstats/models.py
new file mode 100755
index 0000000..f644f71
--- /dev/null
+++ b/cli/sdncon/apps/cstats/models.py
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2013 Big Switch Networks, Inc.
+#
+# Licensed under the Eclipse Public License, Version 1.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+
+from django.db import models
+
+# Create your models here.
diff --git a/cli/sdncon/apps/cstats/static/css/timeselector.css b/cli/sdncon/apps/cstats/static/css/timeselector.css
new file mode 100755
index 0000000..223ee4e
--- /dev/null
+++ b/cli/sdncon/apps/cstats/static/css/timeselector.css
@@ -0,0 +1,122 @@
+ ul.bsntimeinterval {
+ list-style: none;
+ margin: 2px;
+ padding: 0px;
+ vertical-align: middle;
+ clear: both;
+ }
+ ul.bsntimeinterval li {
+ float: left;
+ margin: 0;
+ padding: 0;
+ height: 30px;
+ display: table;
+ border-spacing: 0px;
+ }
+ .bsntimeinterval div.center {
+ display: table-cell;
+ vertical-align: middle;
+ }
+ .bsntimeinterval a {
+ display: block;
+ }
+ a.bsnselector {
+ cursor: pointer;
+ margin: 0px;
+ padding: 3px;
+ border: solid 1px #333333;
+ border-right: none;
+ color: #2E6E9E;
+ vertical-align: middle;
+
+ background-color: #EEEEEE;
+ /* Firefox 3.6+ */
+ background: -moz-linear-gradient(100% 100% 90deg, #CCCCCC, #EEEEEE);
+
+ /* Safari 5.1+, Chrome 10+ */
+ background: -webkit-linear-gradient(#EEEEEE, #CCCCCC);
+
+ /* Opera 11.10+ */
+ background: -o-linear-gradient(#CCCCCC, #EEEEEE);
+
+ }
+ a.bsnselector.left {
+ border-top-left-radius: .5em;
+ border-bottom-left-radius: .5em;
+ }
+ a.bsnselector.right {
+ border-top-right-radius: .5em;
+ border-bottom-right-radius: .5em;
+ border-right: solid 1px #333333;
+ }
+ a.bsnselector:hover {
+ background-color: #DDDDDD;
+
+ /* Firefox 3.6+ */
+ background: -moz-linear-gradient(100% 100% 90deg, #BBBBBB, #DDDDDD);
+
+ /* Safari 5.1+, Chrome 10+ */
+ background: -webkit-linear-gradient(#DDDDDD, #BBBBBB);
+
+ /* Opera 11.10+ */
+ background: -o-linear-gradient(#BBBBBB, #DDDDDD);
+ }
+ a.bsnselector.selected {
+ color: #EEEEEE;
+ background-color: #2E6E9E;
+
+ /* Firefox 3.6+ */
+ background: -moz-linear-gradient(100% 100% 90deg, #2E6E9E, #3D92C2);
+
+ /* Safari 5.1+, Chrome 10+ */
+ background: -webkit-linear-gradient(#3D92C2, #2E6E9E);
+
+ /* Opera 11.10+ */
+ background: -o-linear-gradient(#2E6E9E, #3D92C2);
+ }
+ .bsnlabel {
+ margin-left: 5px;
+ margin-right: 2px;
+ }
+ .bsnlabel.disabled {
+ color: #BBBBBB;
+ }
+ .bsntimepicker {
+ width: 10em;
+ }
+ .bsncheckbox {
+ vertical-align: middle;
+ margin-left: 5px;
+ margin-right: 0px;
+ }
+ .bsnarrow {
+ cursor: pointer;
+ padding-left: 3px;
+ padding-right: 3px;
+ }
+ .bsnarrow div {
+ width: 0;
+ height: 0;
+ }
+ .bsnarrow.left div {
+ border-top: 11px solid transparent;
+ border-bottom: 11px solid transparent;
+ border-right:10px solid #CCCCCC;
+ }
+ .bsnarrow.left:hover div {
+ border-right:10px solid #2E6E9E;
+ }
+ .bsnarrow.right div {
+ border-top: 11px solid transparent;
+ border-bottom: 11px solid transparent;
+ border-left: 10px solid #CCCCCC;
+ }
+ .bsnarrow.right:hover div {
+ border-left: 10px solid #2E6E9E;
+ }
+ .bsncheckbox {
+ display: inline;
+ }
+ .clear {
+ clear: both;
+ }
\ No newline at end of file
diff --git a/cli/sdncon/apps/cstats/tests.py b/cli/sdncon/apps/cstats/tests.py
new file mode 100755
index 0000000..793e610
--- /dev/null
+++ b/cli/sdncon/apps/cstats/tests.py
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2013 Big Switch Networks, Inc.
+#
+# Licensed under the Eclipse Public License, Version 1.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
diff --git a/cli/sdncon/apps/cstats/urls.py b/cli/sdncon/apps/cstats/urls.py
new file mode 100755
index 0000000..175841f
--- /dev/null
+++ b/cli/sdncon/apps/cstats/urls.py
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2013 Big Switch Networks, Inc.
+#
+# Licensed under the Eclipse Public License, Version 1.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+
+from django.conf.urls.defaults import *
+import os
+
+# Add the URLs that you need here e.g.:
+
+urlpatterns = patterns('',
+# (r'^tab_mytab/', 'views.mytab'),
+)
+
+# Uncomment this if you have bundeled in static resources (e.g. javascript) or images
+# They will be served from:
+# app-name/static
+# app-name/img
+
+urlpatterns += patterns('',
+ (r'^static/(?P<path>.*)$', 'django.views.static.serve', \
+ {'document_root': os.path.join(os.path.dirname(__file__),'static')}),
+# (r'^img/(?P<path>.*)$', 'django.views.static.serve', \
+# {'document_root': os.path.join(os.path.dirname(__file__),'img')}),
+)
+
diff --git a/cli/sdncon/apps/cstats/views.py b/cli/sdncon/apps/cstats/views.py
new file mode 100755
index 0000000..eef38dd
--- /dev/null
+++ b/cli/sdncon/apps/cstats/views.py
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2013 Big Switch Networks, Inc.
+#
+# Licensed under the Eclipse Public License, Version 1.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+
+# Views for the application
+#
+
+from django.shortcuts import render_to_response
+from sdncon.apploader import AppLoader, AppLister
+from sdncon.controller.models import Switch
+import os
+
+def bsc_app_init():
+ # By default, App Name is the same as directory name. Change if needed.
+ APP_NAME = os.path.dirname(__file__).split("/")[-1]
+
+ # Create the App. Parameters are
+ # - Name: the id, lowercase letters only
+ # - Label: Human readable discription for the menu to the left
+ # - Priority: determines ranking the menu to the left), One-line description
+ # - Description: One line description of the app
+ app = AppLister(APP_NAME, "Controller Stats", 5, "Controller Stats")
+
+ # Add Tabs. Parameters are:
+ # - Name: the id, lowercase letters only
+ # - Label: Human readable discription for the menu to the left
+ # - View: name of the python function that contains the django view (see below)
+ app.addTab("openflow_graphs", "OpenFlow Graphs", flow_graphs_view)
+ app.addTab("system_graphs", "System Graphs", system_stats_graph_view)
+ AppLoader.addApp(app)
+
+def system_stats_graph_view(request):
+ return render_to_response('apps/cstats/templates/graphs.html', {} )
+
+def flow_graphs_view(request):
+ return render_to_response('apps/cstats/templates/openflowgraphs.html', {} )
+