+++ /dev/null
-#
-# Copyright 2017 CNIT - Consorzio Nazionale Interuniversitario per le Telecomunicazioni
-#
-# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an 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.
-#
-
-import json
-import pyaml
-import yaml
-from lib.util import Util
-from lib.parser import Parser
-import logging
-import traceback
-import glob
-import os
-
-logging.basicConfig(level=logging.DEBUG)
-log = logging.getLogger('OsmParser')
-
-class OsmParser(Parser):
- """Parser methods for osm project type
-
- """
-
- def __init__(self):
- super(OsmParser, self).__init__()
-
- @classmethod
- def importprojectdir(cls,dir_project, file_type):
- """Imports all descriptor files under a given folder
-
- this method is specific for Osm project type
- """
-
- project = {
- 'nsd':{},
-
- 'vnfd':{},
-
- 'positions': {}
- }
-
-
- for desc_type in project:
- cur_type_path = os.path.join(dir_project, desc_type.upper())
- log.debug(cur_type_path)
- if os.path.isdir(cur_type_path):
- for file in glob.glob(os.path.join(cur_type_path, '*.'+file_type)):
- if file_type == 'json':
- project[desc_type][os.path.basename(file).split('.')[0]] = Util.loadjsonfile(file)
- elif file_type == 'yaml':
- project[desc_type][os.path.basename(file).split('.')[0]] = Util.loadyamlfile(file)
-
-
- for vertices_file in glob.glob(os.path.join(dir_project, '*.json')):
- if os.path.basename(vertices_file) == 'vertices.json':
- project['positions']['vertices'] = Util.loadjsonfile(vertices_file)
-
- return project
-
- @classmethod
- def importprojectfiles(cls, file_dict):
- """Imports descriptors (extracted from the new project POST)
-
- The keys in the dictionary are the file types
- """
- project = {
- 'nsd':{},
-
- 'vnfd':{},
-
- }
- for desc_type in project:
- if desc_type in file_dict:
- files_desc_type = file_dict[desc_type]
- for file in files_desc_type:
- project[desc_type][os.path.splitext(file.name)[0]] = json.loads(file.read())
-
- return project
\ No newline at end of file
+++ /dev/null
-#
-# Copyright 2017 CNIT - Consorzio Nazionale Interuniversitario per le Telecomunicazioni
-#
-# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an 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.
-#
-
-import json
-import logging
-import copy
-from lib.rdcl_graph import RdclGraph
-
-logging.basicConfig(level=logging.DEBUG)
-log = logging.getLogger('OsmRdclGraph')
-
-class OsmRdclGraph(RdclGraph):
- """Operates on the graph representation used for the GUI graph views"""
-
- def __init__(self):
- pass
-
-
- def build_graph_from_project(self, json_project, model={}):
- """Creates a single graph for a whole project"""
-
- #print "json_project ",json_project
- graph_object = {
- 'vertices': [],
- 'edges': [],
- 'graph_parameters': {},
- 'model': model
- }
- try:
- positions = json_project['positions'] if 'positions' in json_project else False
- log.debug('build graph from project json')
-
-
- except Exception as e:
- log.exception('Exception in build_graph_from_project')
- raise
-
- return graph_object
--- /dev/null
+#
+# Copyright 2018 EveryUP Srl
+#
+# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 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.
+#
+
+import json
+import pyaml
+import yaml
+from lib.util import Util
+from lib.parser import Parser
+import logging
+import traceback
+import glob
+import os
+
+logging.basicConfig(level=logging.DEBUG)
+log = logging.getLogger('OsmParser')
+
+
+class OsmParser(Parser):
+ """Parser methods for osm project type
+
+ """
+++ /dev/null
-#
-# Copyright 2017 CNIT - Consorzio Nazionale Interuniversitario per le Telecomunicazioni
-#
-# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an 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.
-#
-
-import json
-import pyaml
-import yaml
-from lib.util import Util
-import logging
-import traceback
-import glob
-import os
-
-
-class Parser(object):
- """Parser methods base class
-
- """
-
- def __init__(self):
- pass
-
- @classmethod
- def importprojectdir(cls,dir_project, type):
- """Imports all files under a given folder
-
- Returns an empty project
- """
-
- project = {}
- return project
-
- def get_all_ns_descriptors(self, nsd_id, project_data):
- raise NotImplementedError
\ No newline at end of file
{% block resource_block %}
{{ block.super }}
+ <script src="/static/bower_components/select2/dist/js/select2.js"></script>
+ <script src="/static/src/instancehandler/instance_create.js"></script>
+ <script src="/static/src/projecthandler/descriptorslist.js"></script>
+ <script src="/static/src/projecthandler/onboard_package.js"></script>
+
<script>
var csrf_token = '{{csrf_token}}';
var descr_list_url = '{% url "projects:list_descriptors" descriptor_type=descriptor_type%}';
var new_desc_url ="{% url 'projects:new_descriptor' descriptor_type=descriptor_type %}";
var descriptor_type = '{{ descriptor_type }}';
var project_id = '{{ project_id }}';
+ var table;
+
+ function refreshTable() {
+ table.ajax.reload();
+ }
+
$(document).ready( function () {
- var table = $('#descriptors_table').DataTable({
+ table = $('#descriptors_table').DataTable({
responsive: true,
"ajax": {
"url": "/projects/descriptors/" +descriptor_type+"/list",
});
- setInterval(function () {
- table.ajax.reload();
- }, 10000);
+ setInterval(refreshTable, 10000);
});
</script>
- <script src="/static/bower_components/select2/dist/js/select2.js"></script>
- <script src="/static/src/instancehandler/instance_create.js"></script>
- <script src="/static/src/projecthandler/descriptorslist.js"></script>
- <script src="/static/src/projecthandler/onboard_package.js"></script>
+
{% endblock %}
data.append('text', text);
data.append('id', '{{descriptor_id}}');
console.log(text);
+ var dialog = bootbox.dialog({
+ message: '<div class="text-center"><i class="fa fa-spin fa-spinner"></i> Onboarding...</div>',
+ closeButton: true
+ });
$.ajax({
url: new_desc_url,
type: 'POST',
contentType: false,
processData: false,
success: function (result) {
- console.log(result);
-
- window.location.href = descr_list_url
-
+ dialog.modal('hide');
+ refreshTable();
},
error: function (result) {
+ dialog.modal('hide');
showAlert(result);
}
});