mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-11 21:13:11 +00:00
[config tool][doc]: remove old configurator
remove configurator in misc/config_tools/config_app, since there is new configurator in misc/config_tools/configurator. remove related document. Tracked-On: #7466 Signed-off-by: hangliu1 <hang1.liu@linux.intel.com>
This commit is contained in:
parent
a65a347f34
commit
3afb222d90
@ -39,7 +39,6 @@ Configuration Tutorials
|
|||||||
|
|
||||||
tutorials/acrn_configuration_tool
|
tutorials/acrn_configuration_tool
|
||||||
tutorials/board_inspector_tool
|
tutorials/board_inspector_tool
|
||||||
tutorials/acrn_configurator_tool
|
|
||||||
tutorials/upgrading_configuration
|
tutorials/upgrading_configuration
|
||||||
reference/config-options
|
reference/config-options
|
||||||
reference/config-options-launch
|
reference/config-options-launch
|
||||||
|
@ -1,226 +0,0 @@
|
|||||||
.. _acrn_configurator_tool:
|
|
||||||
|
|
||||||
ACRN Configurator Tool
|
|
||||||
######################
|
|
||||||
|
|
||||||
This guide describes all features and uses of the tool.
|
|
||||||
|
|
||||||
About the ACRN Configurator Tool
|
|
||||||
*********************************
|
|
||||||
|
|
||||||
The ACRN Configurator tool ``acrn_configurator.py`` provides a web-based
|
|
||||||
user interface to help you customize your
|
|
||||||
:ref:`ACRN configuration <acrn_configuration_tool>`. Capabilities:
|
|
||||||
|
|
||||||
- reads board information from the specified board configuration file
|
|
||||||
- provides a GUI to help you configure and validate scenario and
|
|
||||||
launch configuration files
|
|
||||||
- generates launch scripts for the specified post-launched User VMs
|
|
||||||
- dynamically creates a new scenario configuration and adds or deletes VM
|
|
||||||
settings in it
|
|
||||||
- dynamically creates a new launch configuration and adds or deletes User VM
|
|
||||||
settings in it
|
|
||||||
|
|
||||||
The tool guides you to configure ACRN in a particular order, due to
|
|
||||||
dependencies among the different types of configuration files. Here's an
|
|
||||||
overview of what to expect:
|
|
||||||
|
|
||||||
#. Import the board configuration file that you generated via the
|
|
||||||
:ref:`Board Inspector tool <board_inspector_tool>`.
|
|
||||||
|
|
||||||
#. Customize your scenario configuration file by defining hypervisor and
|
|
||||||
VM settings that will be used to build the ACRN hypervisor.
|
|
||||||
|
|
||||||
#. If your scenario has post-launched User VMs, customize launch scripts
|
|
||||||
that the Service VM will use to create the VMs
|
|
||||||
and allocate resources to them dynamically at runtime.
|
|
||||||
Customizing launch scripts involves these steps:
|
|
||||||
|
|
||||||
a. Configure settings for all post-launched User VMs in your scenario
|
|
||||||
and save the configuration in a launch configuration file.
|
|
||||||
|
|
||||||
#. Generate the launch scripts. The ACRN Configurator creates one
|
|
||||||
launch script for each VM defined in the launch configuration file.
|
|
||||||
|
|
||||||
Generate a Scenario Configuration File and Launch Scripts
|
|
||||||
*********************************************************
|
|
||||||
|
|
||||||
The following steps describe all options in the ACRN Configurator for generating
|
|
||||||
a custom scenario configuration file and launch scripts.
|
|
||||||
|
|
||||||
#. Make sure the development computer is set up and ready to launch the ACRN
|
|
||||||
Configurator, according to :ref:`gsg-dev-setup` in the Getting Started Guide.
|
|
||||||
|
|
||||||
#. Launch the ACRN Configurator. This example assumes the tool is in the
|
|
||||||
``~/acrn-work/`` directory. Feel free to modify the command as needed.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
~/acrn-work/acrn-hypervisor/misc/config_tools/config_app/acrn_configurator.py
|
|
||||||
|
|
||||||
#. Your web browser should open the website `<http://127.0.0.1:5001/>`_
|
|
||||||
automatically, or you may need to visit this website manually. The ACRN
|
|
||||||
Configurator is supported on Chrome and Firefox.
|
|
||||||
|
|
||||||
#. Click the **Import Board XML** button and browse to the board
|
|
||||||
configuration file that you generated via the
|
|
||||||
:ref:`Board Inspector <board_inspector_tool>`. After the file is uploaded,
|
|
||||||
make sure the board name is selected in the **Board info** drop-down list
|
|
||||||
and the board information appears.
|
|
||||||
|
|
||||||
#. Start the scenario configuration process by selecting an option from the
|
|
||||||
**Scenario Settings** menu on the top banner of the UI or by importing a
|
|
||||||
scenario configuration file via the **Import XML** button. The four options
|
|
||||||
are described below:
|
|
||||||
|
|
||||||
* Click **Create a new scenario** from the **Scenario Settings** menu to
|
|
||||||
dynamically create a new scenario configuration for the current board.
|
|
||||||
|
|
||||||
* Click **Load a default scenario** from the **Scenario Settings** menu to
|
|
||||||
select a :ref:`predefined scenario configuration <usage-scenarios>`.
|
|
||||||
|
|
||||||
* Click the **Scenario Settings** menu and select a scenario from the list
|
|
||||||
under **scenario setting list**.
|
|
||||||
|
|
||||||
.. image:: images/choose_scenario.png
|
|
||||||
:align: center
|
|
||||||
:class: drop-shadow
|
|
||||||
|
|
||||||
* Click the **Import XML** button to import a customized scenario
|
|
||||||
configuration file.
|
|
||||||
The file must be one that was written for the current board. Any mismatch
|
|
||||||
in the board name and the one found in the scenario configuration file you
|
|
||||||
are trying to import will lead to an error message.
|
|
||||||
|
|
||||||
#. When the scenario configuration file is available for editing, the
|
|
||||||
configurable items appear below the **Scenario Setting** row. You may
|
|
||||||
need to scroll down to see them. Example:
|
|
||||||
|
|
||||||
.. image:: images/configure_scenario.png
|
|
||||||
:align: center
|
|
||||||
:class: drop-shadow
|
|
||||||
|
|
||||||
* You can edit these items directly in the text boxes, or you can choose
|
|
||||||
single or even multiple items from the drop-down list.
|
|
||||||
|
|
||||||
* Read-only items are marked as gray.
|
|
||||||
|
|
||||||
* Hover the mouse cursor over the item to see the description.
|
|
||||||
|
|
||||||
#. Add or delete VMs:
|
|
||||||
|
|
||||||
* Click **Add a VM below** in a VM's settings, and then select a VM type
|
|
||||||
to add a new VM under the current VM.
|
|
||||||
|
|
||||||
* Click **Remove this VM** in a VM's settings to remove the VM from the
|
|
||||||
scenario.
|
|
||||||
|
|
||||||
When a VM is added or removed, the ACRN Configurator reassigns the VM IDs for
|
|
||||||
the remaining VMs by the order of pre-launched User VMs, Service VM, and
|
|
||||||
post-launched User VMs.
|
|
||||||
|
|
||||||
.. image:: images/configure_vm_add.png
|
|
||||||
:align: center
|
|
||||||
:class: drop-shadow
|
|
||||||
|
|
||||||
#. Click **Export XML** to save the scenario configuration file. A dialog box
|
|
||||||
appears, enabling you to save the file to a specific folder by inputting the
|
|
||||||
absolute path to this folder. If you don't specify a path, the file will be
|
|
||||||
saved to the default folder: ``acrn-hypervisor/../user_config/<board name>``.
|
|
||||||
|
|
||||||
Before saving the scenario configuration file, the Configurator validates
|
|
||||||
the configurable items. If errors exist, the Configurator lists all
|
|
||||||
incorrectly configured items and shows the errors. Example:
|
|
||||||
|
|
||||||
.. image:: images/err_acrn_configuration.png
|
|
||||||
:align: center
|
|
||||||
:class: drop-shadow
|
|
||||||
|
|
||||||
After the scenario is saved, the page automatically displays the saved
|
|
||||||
scenario configuration file.
|
|
||||||
|
|
||||||
#. To delete a scenario configuration file, click **Export XML** > **Remove**.
|
|
||||||
The Configurator will delete the loaded file, even if you change the name of
|
|
||||||
the file in the dialog box.
|
|
||||||
|
|
||||||
#. If your scenario has post-launched User VMs, continue to the next step
|
|
||||||
to create launch scripts for those VMs. If your scenario doesn't have
|
|
||||||
post-launched User VMs, you can skip to the final step to close the tool.
|
|
||||||
|
|
||||||
#. Start the launch script configuration process by
|
|
||||||
selecting an option from the **Launch Settings** menu on the top banner of
|
|
||||||
the UI or by importing a launch configuration file via the **Import XML**
|
|
||||||
button. The four options are described below:
|
|
||||||
|
|
||||||
* Click **Create a new launch script** from the **Launch Settings** menu to
|
|
||||||
dynamically create a new launch configuration for the current board.
|
|
||||||
|
|
||||||
* Click **Load a default launch script** from the **Launch Settings** menu to
|
|
||||||
select a predefined launch configuration.
|
|
||||||
|
|
||||||
* Click the **Launch Settings** menu and select a launch configuration
|
|
||||||
from the list under **launch setting list**.
|
|
||||||
|
|
||||||
.. image:: images/choose_launch.png
|
|
||||||
:align: center
|
|
||||||
:class: drop-shadow
|
|
||||||
|
|
||||||
* Click the **Import XML** button to import a customized launch
|
|
||||||
configuration file.
|
|
||||||
|
|
||||||
#. Select a scenario for the current launch configuration from the
|
|
||||||
**Select Scenario** drop-down box.
|
|
||||||
|
|
||||||
#. When the launch configuration file is available for editing, the
|
|
||||||
configurable items appear below the **Launch Setting** row. You may need
|
|
||||||
to scroll down to see them. Example:
|
|
||||||
|
|
||||||
.. image:: images/configure_launch.png
|
|
||||||
:align: center
|
|
||||||
:class: drop-shadow
|
|
||||||
|
|
||||||
* You can edit these items directly in the text boxes, or you can choose
|
|
||||||
single or even multiple items from the drop-down list.
|
|
||||||
|
|
||||||
* Read-only items are marked as gray.
|
|
||||||
|
|
||||||
* Hover the mouse cursor over the item to see the description.
|
|
||||||
|
|
||||||
#. Add or remove User VM launch scripts:
|
|
||||||
|
|
||||||
* Click **Configure a User VM below** to add a User VM launch script.
|
|
||||||
|
|
||||||
* Click **Remove this VM** to remove a User VM launch script.
|
|
||||||
|
|
||||||
.. image:: images/configure_launch_add.png
|
|
||||||
:align: center
|
|
||||||
:class: drop-shadow
|
|
||||||
|
|
||||||
#. Click **Export XML** to save the launch configuration file. A dialog box
|
|
||||||
appears, enabling you to save the file to a specific folder by inputting the
|
|
||||||
absolute path to this folder. If you don't specify a path, the file will
|
|
||||||
be saved to the default folder:
|
|
||||||
``acrn-hypervisor/../user_config/<board name>``.
|
|
||||||
|
|
||||||
Before saving the launch configuration file, the Configurator validates the
|
|
||||||
configurable items. If errors exist, the Configurator lists all incorrectly
|
|
||||||
configured items and shows the errors.
|
|
||||||
|
|
||||||
#. To delete a launch configuration file, click **Export XML** > **Remove**.
|
|
||||||
The Configurator will delete the loaded file, even if you change the name of
|
|
||||||
the file in the dialog box.
|
|
||||||
|
|
||||||
#. Click **Generate Launch Script** to save the current launch configuration
|
|
||||||
and then generate a launch script for each VM defined in the launch
|
|
||||||
configuration.
|
|
||||||
|
|
||||||
.. image:: images/generate_launch_script.png
|
|
||||||
:align: center
|
|
||||||
:class: drop-shadow
|
|
||||||
|
|
||||||
#. Confirm that the launch scripts appear in the
|
|
||||||
``<board name>/output`` directory.
|
|
||||||
|
|
||||||
#. When you are done using the tool, close the browser and press
|
|
||||||
:kbd:`CTRL` + :kbd:`C` to terminate the
|
|
||||||
``acrn_configurator.py`` program running in the terminal window.
|
|
@ -1,45 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
# Copyright (C) 2019 Intel Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
"""Entry for config app.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import threading
|
|
||||||
import webbrowser
|
|
||||||
|
|
||||||
# flask: Copyright 2010 Pallets
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
# Refer to https://github.com/pallets/flask/blob/master/LICENSE.rst for the permission notice.
|
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
# flask: Copyright (c) 2013, Marc Brinkmann
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
# Refer to https://pypi.org/project/Flask-Bootstrap/ for the permission notice.
|
|
||||||
from flask_bootstrap import Bootstrap
|
|
||||||
|
|
||||||
import configs
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..',
|
|
||||||
'board_config'))
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..',
|
|
||||||
'scenario_config'))
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..',
|
|
||||||
'launch_config'))
|
|
||||||
from views import CONFIG_APP
|
|
||||||
|
|
||||||
APP = Flask(__name__)
|
|
||||||
APP.config.from_object(configs)
|
|
||||||
APP.register_blueprint(CONFIG_APP)
|
|
||||||
APP.jinja_env.add_extension('jinja2.ext.do')
|
|
||||||
Bootstrap(app=APP)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
URL = "http://127.0.0.1:5001/scenario"
|
|
||||||
threading.Timer(1, lambda: webbrowser.open(URL)).start()
|
|
||||||
APP.run(port=5001, debug=False)
|
|
@ -1,18 +0,0 @@
|
|||||||
# Copyright (C) 2019 Intel Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
"""Configurations for config app.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
BOARD_INFO = None
|
|
||||||
BOARD_TYPE = None
|
|
||||||
SCENARIO = None
|
|
||||||
LAUNCH = None
|
|
||||||
DEFAULT_CONFIG_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data')
|
|
||||||
CONFIG_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..', 'user_config')
|
|
||||||
|
|
||||||
if not os.path.isdir(CONFIG_PATH):
|
|
||||||
os.makedirs(CONFIG_PATH)
|
|
@ -1,515 +0,0 @@
|
|||||||
# Copyright (C) 2019 Intel Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
"""Controller for config app.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
from xmlschema import XMLSchema11
|
|
||||||
from xmlschema.validators import Xsd11Element, XsdSimpleType, XsdAtomicBuiltin, Xsd11ComplexType, Xsd11Group, Xsd11Attribute
|
|
||||||
import lxml.etree as etree
|
|
||||||
|
|
||||||
|
|
||||||
class XmlConfig:
|
|
||||||
"""The core class to analyze and modify acrn config xml files"""
|
|
||||||
def __init__(self, path=None, default=True):
|
|
||||||
self._xml_path = path
|
|
||||||
self._default = default
|
|
||||||
self._curr_xml = None
|
|
||||||
self._curr_xml_tree = None
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _get_xml_type(xml_file):
|
|
||||||
"""
|
|
||||||
get the config type by file.
|
|
||||||
:param xml_file: the file path of xml file.
|
|
||||||
:return: the xml type.
|
|
||||||
:raises: ValueError, OSError, SyntaxError.
|
|
||||||
"""
|
|
||||||
xml_type = ''
|
|
||||||
if os.path.splitext(xml_file)[1] != '.xml':
|
|
||||||
return xml_type
|
|
||||||
try:
|
|
||||||
tree = etree.parse(xml_file)
|
|
||||||
root = tree.getroot()
|
|
||||||
if 'user_vm_launcher' in root.attrib:
|
|
||||||
xml_type = 'user_vm_launcher'
|
|
||||||
elif 'scenario' in root.attrib:
|
|
||||||
xml_type = 'scenario'
|
|
||||||
elif 'board' in root.attrib:
|
|
||||||
xml_type = 'board'
|
|
||||||
elif 'board_setting' in root.attrib:
|
|
||||||
xml_type = 'board_setting'
|
|
||||||
except ValueError:
|
|
||||||
print('xml parse error: {}'.format(xml_file))
|
|
||||||
xml_type = ''
|
|
||||||
except OSError:
|
|
||||||
print('xml open error: {}'.format(xml_file))
|
|
||||||
xml_type = ''
|
|
||||||
except SyntaxError:
|
|
||||||
print('xml syntax error: {}'.format(xml_file))
|
|
||||||
xml_type = ''
|
|
||||||
|
|
||||||
return xml_type
|
|
||||||
|
|
||||||
def list_all(self, xml_type=None):
|
|
||||||
"""
|
|
||||||
list all xml config files by type.
|
|
||||||
:param xml_type: the xml type.
|
|
||||||
:return: he list of xml config files.
|
|
||||||
"""
|
|
||||||
xmls = []
|
|
||||||
user_xmls = []
|
|
||||||
|
|
||||||
if self._xml_path is None or not os.path.exists(self._xml_path):
|
|
||||||
return xmls, user_xmls
|
|
||||||
for test_file in os.listdir(self._xml_path):
|
|
||||||
test_file_path = os.path.join(self._xml_path, test_file)
|
|
||||||
if os.path.isfile(test_file_path):
|
|
||||||
if XmlConfig._get_xml_type(test_file_path) == xml_type:
|
|
||||||
xmls.append(os.path.splitext(test_file)[0])
|
|
||||||
user_path = os.path.join(self._xml_path, 'user_defined')
|
|
||||||
if os.path.isdir(user_path):
|
|
||||||
for test_file in os.listdir(user_path):
|
|
||||||
test_file_path = os.path.join(user_path, test_file)
|
|
||||||
if os.path.isfile(test_file_path):
|
|
||||||
if XmlConfig._get_xml_type(test_file_path) == xml_type:
|
|
||||||
user_xmls.append(os.path.splitext(test_file)[0])
|
|
||||||
|
|
||||||
return xmls, user_xmls
|
|
||||||
|
|
||||||
def set_curr(self, xml):
|
|
||||||
"""
|
|
||||||
set current xml file to analyze.
|
|
||||||
:param xml: the xml file.
|
|
||||||
:return: None.
|
|
||||||
:raises: ValueError, OSError, SyntaxError.
|
|
||||||
"""
|
|
||||||
if self._xml_path is None or xml is None:
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
self._curr_xml = xml
|
|
||||||
|
|
||||||
xml_path = os.path.join(self._xml_path, self._curr_xml + '.xml') \
|
|
||||||
if self._default \
|
|
||||||
else os.path.join(self._xml_path, 'user_defined', self._curr_xml + '.xml')
|
|
||||||
|
|
||||||
parser = etree.XMLParser(remove_blank_text=True)
|
|
||||||
tree = etree.parse(xml_path, parser)
|
|
||||||
self._curr_xml_tree = tree
|
|
||||||
except ValueError:
|
|
||||||
print('xml parse error: {}'.format(xml))
|
|
||||||
self._curr_xml = None
|
|
||||||
self._curr_xml_tree = None
|
|
||||||
except OSError:
|
|
||||||
print('xml open error: {}'.format(xml))
|
|
||||||
self._curr_xml = None
|
|
||||||
self._curr_xml_tree = None
|
|
||||||
except SyntaxError:
|
|
||||||
print('xml syntax error: {}'.format(xml))
|
|
||||||
self._curr_xml = None
|
|
||||||
self._curr_xml_tree = None
|
|
||||||
|
|
||||||
def get_curr(self):
|
|
||||||
"""
|
|
||||||
get current xml config file.
|
|
||||||
:return: current xml config file name.
|
|
||||||
"""
|
|
||||||
return self._curr_xml
|
|
||||||
|
|
||||||
def get_curr_root(self):
|
|
||||||
"""
|
|
||||||
get the xml root of current xml config file.
|
|
||||||
:return: the xml root of current xml config file.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return None
|
|
||||||
return self._curr_xml_tree.getroot()
|
|
||||||
|
|
||||||
def get_curr_value(self, *args):
|
|
||||||
"""
|
|
||||||
get the value of the element by its path.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: the value of the element.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return None
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
if dest_node is None:
|
|
||||||
return None
|
|
||||||
if dest_node.text is None or dest_node.text.strip() == '':
|
|
||||||
return ''
|
|
||||||
return dest_node.text
|
|
||||||
|
|
||||||
def set_curr_value(self, value, *args):
|
|
||||||
"""
|
|
||||||
set the value of the element by its path.
|
|
||||||
:param value: the value of the element.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
dest_node.text = value
|
|
||||||
|
|
||||||
def set_curr_list(self, values, *args):
|
|
||||||
"""
|
|
||||||
set a list of sub element for the element by its path.
|
|
||||||
:param values: the list of values of the element.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
tag = args[-1]
|
|
||||||
args = args[:-1]
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
new_node_desc = None
|
|
||||||
for node in list(dest_node):
|
|
||||||
if node.tag == tag:
|
|
||||||
if 'desc' in node.attrib:
|
|
||||||
new_node_desc = node.attrib['desc']
|
|
||||||
dest_node.remove(node)
|
|
||||||
for value in values:
|
|
||||||
new_node = etree.SubElement(dest_node, tag)
|
|
||||||
new_node.text = value
|
|
||||||
if new_node_desc is not None:
|
|
||||||
new_node.attrib['desc'] = new_node_desc
|
|
||||||
|
|
||||||
def set_curr_attr(self, attr_name, attr_value, *args):
|
|
||||||
"""
|
|
||||||
set the attribute of the element by its path.
|
|
||||||
:param attr_name: the attribute name of the element.
|
|
||||||
:param attr_value: the attribute value of the element.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
dest_node.attrib[attr_name] = attr_value
|
|
||||||
|
|
||||||
def add_curr_value(self, key, desc, value, *args):
|
|
||||||
"""
|
|
||||||
add a sub element for the element by its path.
|
|
||||||
:param key: the tag of the sub element.
|
|
||||||
:param desc: the attribute desc of the sub element.
|
|
||||||
:param value: the value of the sub element.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
|
|
||||||
if key in ['vm']:
|
|
||||||
etree.SubElement(dest_node, key, attrib={'id': value, 'desc': desc})
|
|
||||||
else:
|
|
||||||
new_node = etree.SubElement(dest_node, key, attrib={'desc': desc})
|
|
||||||
new_node.text = value
|
|
||||||
|
|
||||||
def get_curr_elem(self, *args):
|
|
||||||
"""
|
|
||||||
get elements for current path.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: current element.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
return dest_node
|
|
||||||
|
|
||||||
def clone_curr_elem(self, elem, *args):
|
|
||||||
"""
|
|
||||||
clone elements for current path.
|
|
||||||
:param elem: the element to clone.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
dest_node.append(elem)
|
|
||||||
|
|
||||||
def insert_curr_elem(self, index, elem, *args):
|
|
||||||
"""
|
|
||||||
insert elements for current path.
|
|
||||||
:param index: the location for the element to insert.
|
|
||||||
:param elem: the element to insert.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
dest_node.insert(index, elem)
|
|
||||||
|
|
||||||
def delete_curr_elem(self, *args):
|
|
||||||
"""
|
|
||||||
delete the element by its path.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
father_node = self._get_dest_node(*args[:-1])
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
father_node.remove(dest_node)
|
|
||||||
|
|
||||||
def delete_curr_key(self, *args):
|
|
||||||
"""
|
|
||||||
delete the element by its path.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
dest_node = self._get_dest_node(*args)
|
|
||||||
self._curr_xml_tree.getroot().remove(dest_node)
|
|
||||||
|
|
||||||
def _get_dest_node(self, *args):
|
|
||||||
"""
|
|
||||||
get the destination element by its path.
|
|
||||||
:param args: the path of the element.
|
|
||||||
:return: the destination element.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return None
|
|
||||||
dest_node = self._curr_xml_tree.getroot()
|
|
||||||
path = '.'
|
|
||||||
for arg in args:
|
|
||||||
# tag:attr=xxx
|
|
||||||
# tag:attr
|
|
||||||
# tag
|
|
||||||
tag = None
|
|
||||||
attr_name = None
|
|
||||||
attr_value = None
|
|
||||||
if ':' not in arg:
|
|
||||||
tag = arg
|
|
||||||
elif '=' not in arg:
|
|
||||||
# tag = arg.split(':')[0]
|
|
||||||
# attr_name = arg.split(':')[1]
|
|
||||||
raise Exception('unsupported xml path: tag:attr')
|
|
||||||
else:
|
|
||||||
tag = arg.split(':')[0]
|
|
||||||
attr = arg.split(':')[1]
|
|
||||||
attr_name = attr.split('=')[0]
|
|
||||||
attr_value = attr.split('=')[1]
|
|
||||||
|
|
||||||
if attr_value is None:
|
|
||||||
path += ("/" + tag)
|
|
||||||
else:
|
|
||||||
path += ("/" + tag + "[@" + attr_name + "='" + attr_value + "']")
|
|
||||||
|
|
||||||
dest_node = dest_node.findall(path)
|
|
||||||
if dest_node is not None and dest_node != []:
|
|
||||||
return dest_node[0]
|
|
||||||
|
|
||||||
raise Exception('can not find node by {} from xml'.format(args))
|
|
||||||
|
|
||||||
def save(self, xml=None, user_defined=False):
|
|
||||||
"""
|
|
||||||
save current xml to file.
|
|
||||||
:param xml: the file name to save; if not specified, save current xml to default names.
|
|
||||||
:param user_defined: save to user defined folder or default folder.
|
|
||||||
:return: None.
|
|
||||||
"""
|
|
||||||
if self._curr_xml_tree is None:
|
|
||||||
return
|
|
||||||
if xml is None:
|
|
||||||
xml = self._curr_xml
|
|
||||||
|
|
||||||
xml_path = self._xml_path
|
|
||||||
if user_defined:
|
|
||||||
xml_path = os.path.join(self._xml_path, 'user_defined')
|
|
||||||
if not os.path.isdir(xml_path):
|
|
||||||
os.makedirs(xml_path)
|
|
||||||
|
|
||||||
self._curr_xml_tree.write(os.path.join(xml_path, xml+'.xml'), encoding='utf-8', pretty_print=True)
|
|
||||||
|
|
||||||
def _format_xml(self, element, depth=0):
|
|
||||||
i = "\n" + depth * " "
|
|
||||||
if element:
|
|
||||||
if not element.text or not element.text.strip():
|
|
||||||
element.text = i + " "
|
|
||||||
if not element.tail or not element.tail.strip():
|
|
||||||
element.tail = i
|
|
||||||
for element in element:
|
|
||||||
self._format_xml(element, depth + 1)
|
|
||||||
if not element.tail or not element.tail.strip():
|
|
||||||
element.tail = i
|
|
||||||
else:
|
|
||||||
if depth and (not element.tail or not element.tail.strip()):
|
|
||||||
element.tail = i
|
|
||||||
|
|
||||||
|
|
||||||
def get_acrn_config_element(xsd_file):
|
|
||||||
"""
|
|
||||||
return the root element for the xsd file
|
|
||||||
:param xsd_file: the input xsd schema file
|
|
||||||
:return: the root element of the xsd file
|
|
||||||
"""
|
|
||||||
# schema = XMLSchema11(xsd_file)
|
|
||||||
xsd_doc = etree.parse(xsd_file)
|
|
||||||
xsd_doc.xinclude()
|
|
||||||
schema = XMLSchema11(etree.tostring(xsd_doc, encoding="unicode"))
|
|
||||||
|
|
||||||
xsd_element_root = schema.root_elements[0]
|
|
||||||
acrn_config_element_root = xsd_2_acrn_config_element(xsd_element_root)
|
|
||||||
# doc_dict = acrn_config_element_2_doc_dict(acrn_config_element_root, {})
|
|
||||||
# enum_dict = acrn_config_element_2_enum_dict(acrn_config_element_root, {})
|
|
||||||
# xpath_dict = acrn_config_element_2_xpath_dict(acrn_config_element_root, {})
|
|
||||||
|
|
||||||
# from pprint import pprint
|
|
||||||
# pprint(acrn_config_element_root)
|
|
||||||
# pprint(xpath_dict)
|
|
||||||
|
|
||||||
return acrn_config_element_root
|
|
||||||
|
|
||||||
|
|
||||||
def xsd_2_acrn_config_element(xsd_element, layer=0, index=0, path=''):
|
|
||||||
"""
|
|
||||||
translate XSD element to ACRN config element
|
|
||||||
:param xsd_element: the xsd element
|
|
||||||
:param layer: current layer
|
|
||||||
:param index: current index of current layer
|
|
||||||
:param path: path of current element
|
|
||||||
:return: ACRN config element
|
|
||||||
"""
|
|
||||||
acrn_config_element = {
|
|
||||||
'name': xsd_element.name,
|
|
||||||
'type': None,
|
|
||||||
'path': path+'/'+xsd_element.name,
|
|
||||||
'layer': layer,
|
|
||||||
'index': index,
|
|
||||||
'doc': None,
|
|
||||||
'configurable': 'y',
|
|
||||||
'readonly': 'n',
|
|
||||||
'multiselect': 'n',
|
|
||||||
'default': xsd_element.default,
|
|
||||||
'attributes': None,
|
|
||||||
# 'minOccurs': None,
|
|
||||||
# 'maxOccurs': None,
|
|
||||||
'enumeration': None,
|
|
||||||
'sub_elements': None
|
|
||||||
}
|
|
||||||
if isinstance(xsd_element.type, Xsd11ComplexType):
|
|
||||||
acrn_config_element['type'] = xsd_element.type.name
|
|
||||||
for xsd_component in xsd_element.type.iter_components():
|
|
||||||
if isinstance(xsd_component, Xsd11Group):
|
|
||||||
if acrn_config_element['sub_elements'] is None:
|
|
||||||
acrn_config_element['sub_elements'] = {'all':[], 'choice':[], 'sequence':[]}
|
|
||||||
index = 0
|
|
||||||
for sub_xsd_component in xsd_component.iter_components():
|
|
||||||
if isinstance(sub_xsd_component, Xsd11Element):
|
|
||||||
sub_acrn_config_element = xsd_2_acrn_config_element(sub_xsd_component, layer+1,
|
|
||||||
index, path+'/'+xsd_element.name)
|
|
||||||
acrn_config_element['sub_elements'][xsd_component.model].append(sub_acrn_config_element)
|
|
||||||
index += 1
|
|
||||||
else:
|
|
||||||
if isinstance(xsd_element.type, XsdAtomicBuiltin):
|
|
||||||
acrn_config_element['type'] = xsd_element.type.name
|
|
||||||
elif isinstance(xsd_element.type.base_type, XsdSimpleType):
|
|
||||||
acrn_config_element['type'] = xsd_element.type.base_type.name
|
|
||||||
else:
|
|
||||||
acrn_config_element['type'] = xsd_element.type.name
|
|
||||||
if xsd_element.type.enumeration:
|
|
||||||
acrn_config_element['enumeration'] = xsd_element.type.enumeration
|
|
||||||
|
|
||||||
annotation = None
|
|
||||||
if hasattr(xsd_element, 'annotation') and xsd_element.annotation:
|
|
||||||
annotation = xsd_element.annotation
|
|
||||||
elif hasattr(xsd_element.type, 'annotation') and xsd_element.type.annotation:
|
|
||||||
annotation = xsd_element.type.annotation
|
|
||||||
if annotation:
|
|
||||||
if annotation.documentation:
|
|
||||||
doc_list = [documentation.text for documentation in annotation.documentation]
|
|
||||||
acrn_config_element['doc'] = '\n'.join(doc_list)
|
|
||||||
for key in annotation.elem.keys():
|
|
||||||
if key.endswith('configurable'):
|
|
||||||
acrn_config_element['configurable'] = annotation.elem.get(key)
|
|
||||||
elif key.endswith('readonly'):
|
|
||||||
acrn_config_element['readonly'] = annotation.elem.get(key)
|
|
||||||
elif key.endswith('multiselect'):
|
|
||||||
acrn_config_element['multiselect'] = annotation.elem.get(key)
|
|
||||||
|
|
||||||
if xsd_element.attributes:
|
|
||||||
attrs = []
|
|
||||||
for attr in xsd_element.attributes.iter_components():
|
|
||||||
if isinstance(attr, Xsd11Attribute):
|
|
||||||
attrs.append({'name': attr.name, 'type': attr.type.name})
|
|
||||||
acrn_config_element['attributes'] = attrs
|
|
||||||
|
|
||||||
return acrn_config_element
|
|
||||||
|
|
||||||
def acrn_config_element_2_doc_dict(acrn_config_element, doc_dict):
|
|
||||||
"""
|
|
||||||
get the dictionary for documentation of all configurable elements by ACRN config element.
|
|
||||||
:param acrn_config_element: the ACRN config element
|
|
||||||
:param doc_dict: the dictionary to save documentation of all configurable elements
|
|
||||||
:return: the dictionary to save documentation of all configurable elements
|
|
||||||
"""
|
|
||||||
if 'doc' in acrn_config_element and 'path' in acrn_config_element \
|
|
||||||
and acrn_config_element['path'] not in doc_dict:
|
|
||||||
if acrn_config_element['doc']:
|
|
||||||
doc_dict[acrn_config_element['path']] = acrn_config_element['doc']
|
|
||||||
else:
|
|
||||||
doc_dict[acrn_config_element['path']] = acrn_config_element['name']
|
|
||||||
|
|
||||||
if 'sub_elements' in acrn_config_element and acrn_config_element['sub_elements']:
|
|
||||||
for order_type in acrn_config_element['sub_elements']:
|
|
||||||
for element in acrn_config_element['sub_elements'][order_type]:
|
|
||||||
doc_dict = acrn_config_element_2_doc_dict(element, doc_dict)
|
|
||||||
return doc_dict
|
|
||||||
|
|
||||||
def acrn_config_element_2_enum_dict(acrn_config_element, enum_dict):
|
|
||||||
"""
|
|
||||||
get the dictionary for enumeration of all configurable elements by ACRN config element.
|
|
||||||
:param acrn_config_element: the ACRN config element
|
|
||||||
:param enum_dict: the dictionary to save enumeration of all configurable elements
|
|
||||||
:return: the dictionary to save enumeration of all configurable elements
|
|
||||||
"""
|
|
||||||
if 'enumeration' in acrn_config_element and 'path' in acrn_config_element \
|
|
||||||
and acrn_config_element['path'] not in enum_dict \
|
|
||||||
and acrn_config_element['enumeration']:
|
|
||||||
enum_dict[acrn_config_element['path']] = acrn_config_element['enumeration']
|
|
||||||
if 'sub_elements' in acrn_config_element and acrn_config_element['sub_elements']:
|
|
||||||
for order_type in acrn_config_element['sub_elements']:
|
|
||||||
for element in acrn_config_element['sub_elements'][order_type]:
|
|
||||||
enum_dict = acrn_config_element_2_enum_dict(element, enum_dict)
|
|
||||||
return enum_dict
|
|
||||||
|
|
||||||
def acrn_config_element_2_xpath_dict(acrn_config_element, xpath_dict):
|
|
||||||
"""
|
|
||||||
get the dictionary for xpath of all configurable elements by ACRN config element.
|
|
||||||
:param acrn_config_element: the ACRN config element
|
|
||||||
:param xpath_dict: the dictionary to save xpath of all configurable elements
|
|
||||||
:return: the dictionary to save xpath of all configurable elements
|
|
||||||
"""
|
|
||||||
if acrn_config_element['path'] not in xpath_dict.keys():
|
|
||||||
xpath_dict[acrn_config_element['path']] = {
|
|
||||||
'name': acrn_config_element['name'],
|
|
||||||
'type': acrn_config_element['type'],
|
|
||||||
'layer': acrn_config_element['layer'],
|
|
||||||
'index': acrn_config_element['index'],
|
|
||||||
'doc': acrn_config_element['doc'] if acrn_config_element['doc'] else acrn_config_element['name'],
|
|
||||||
'configurable': acrn_config_element['configurable'],
|
|
||||||
'readonly': acrn_config_element['readonly'],
|
|
||||||
'multiselect': acrn_config_element['multiselect'],
|
|
||||||
'default': acrn_config_element['default'],
|
|
||||||
'attributes': acrn_config_element['attributes'],
|
|
||||||
# 'minOccurs': None,
|
|
||||||
# 'maxOccurs': None,
|
|
||||||
'enumeration': acrn_config_element['enumeration']
|
|
||||||
}
|
|
||||||
if 'sub_elements' in acrn_config_element and acrn_config_element['sub_elements']:
|
|
||||||
for order_type in acrn_config_element['sub_elements']:
|
|
||||||
for element in acrn_config_element['sub_elements'][order_type]:
|
|
||||||
enum_dict = acrn_config_element_2_xpath_dict(element, xpath_dict)
|
|
||||||
return xpath_dict
|
|
@ -1,5 +0,0 @@
|
|||||||
Flask==1.1.1
|
|
||||||
flask_bootstrap==3.3.7.1
|
|
||||||
xmlschema==1.4.1
|
|
||||||
lxml==4.6.2
|
|
||||||
defusedxml==0.7.1
|
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +0,0 @@
|
|||||||
* {
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.428;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.nav li.dropdown:hover ul.dropdown-menu {
|
|
||||||
display: block;
|
|
||||||
}
|
|
@ -1,210 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>{% block title %}{% endblock %}</title>
|
|
||||||
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
|
|
||||||
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
|
|
||||||
<link rel="stylesheet"
|
|
||||||
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css">
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap-select.min.js"></script>
|
|
||||||
<link href="../static/styles.css" rel="stylesheet" type="text/css">
|
|
||||||
<script src="../static/main.js" type="text/javascript"></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="modal fade" id="create_modal" tabindex="-1" role="dialog" aria-labelledby="createModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h4 class="modal-title" id="createModalLabel"></h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="create_name" class="col-sm-3 control-label">Name: </label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="create_name"
|
|
||||||
value="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" id="create_btn" data-id="" class="btn btn-primary">OK
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="load_scenario_modal" tabindex="-1" role="dialog" aria-labelledby="loadScenarioModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h4 class="modal-title" id="loadScenarioModalLabel">Load Default Scenario Settings</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="load_scenario_name" class="col-sm-3 control-label">Default Scenario Setting: </label>
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
<select class="selectpicker" data-width="auto" id="load_scenario_name">
|
|
||||||
{% if scenarios[0] %}
|
|
||||||
{% for sc in scenarios[0] %}
|
|
||||||
<option value="{{sc}}">{{sc}}</option>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="load_scenario_name2" class="col-sm-3 control-label">Scenario Setting Name: </label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="load_scenario_name2"
|
|
||||||
value="{{scenarios[0][0] if scenarios[0] else ''}}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" id="load_scenario_btn" data-id="scenario" class="btn btn-primary">OK
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="load_launch_modal" tabindex="-1" role="dialog" aria-labelledby="loadLaunchModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h4 class="modal-title" id="loadLaunchModalLabel">Load Default Launch Settings</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="load_launch_name" class="col-sm-3 control-label">Default Launch Setting: </label>
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
<select class="selectpicker" data-width="auto" id="load_launch_name">
|
|
||||||
{% if launches[0] %}
|
|
||||||
{% for lc in launches[0] %}
|
|
||||||
<option value="{{lc}}">{{lc}}</option>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="load_launch_name2" class="col-sm-3 control-label">Launch Setting Name: </label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="load_launch_name2"
|
|
||||||
value="{{launches[0][0] if launches[0] else ''}}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" id="load_launch_btn" data-id="launch" class="btn btn-primary">OK
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-inverse">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<a class="navbar-brand" href="{{ url_for('CONFIG_APP.scenarios') }}">ACRN Configurator</a>
|
|
||||||
</div>
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li class="dropdown">
|
|
||||||
<a href="{{ url_for('CONFIG_APP.scenarios') }}">
|
|
||||||
Scenario Settings<span class="caret"></span></a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
{% if board_info %}
|
|
||||||
<li><a href="" data-toggle="modal" data-target="#create_modal" class="create_menu"
|
|
||||||
data-id="scenario">Create a new scenario</a></li>
|
|
||||||
<li><a href="" data-toggle="modal" data-target="#load_scenario_modal" class="load_menu"
|
|
||||||
data-id="scenario">Load a default scenario</a></li>
|
|
||||||
<small class="text-muted">scenario setting list</small>
|
|
||||||
{% for sc in scenarios[1] %}
|
|
||||||
<li><a href="{{ url_for('CONFIG_APP.scenario', scenario_name=sc) }}">{{sc}}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
<text class="form-control" id="err_msg" data-toggle="tooltip"
|
|
||||||
title="No board selected or not supported board">No Setting
|
|
||||||
</text>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="dropdown">
|
|
||||||
<a href="{{ url_for('CONFIG_APP.launches') }}">Launch Settings <span
|
|
||||||
class="caret"></span></a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
{% if board_info %}
|
|
||||||
<li><a href="" data-toggle="modal" data-target="#create_modal" class="create_menu"
|
|
||||||
data-id="launch">Create a new Launch script</a></li>
|
|
||||||
<li><a href="" data-toggle="modal" data-target="#load_launch_modal" class="load_menu"
|
|
||||||
data-id="launch">Load a default launch script</a></li>
|
|
||||||
<small class="text-muted">launch setting list</small>
|
|
||||||
{% for lc in launches[1] %}
|
|
||||||
<li><a href="{{ url_for('CONFIG_APP.launch', launch_name=lc) }}">{{lc}}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
<text class="form-control" id="err_msg" data-toggle="tooltip"
|
|
||||||
title="No board selected or not supported board">No Setting
|
|
||||||
</text>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<form class="form-horizontal" action="" enctype="multipart/form-data" method='POST'>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label" style="text-align: left;"> Board info:</label>
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<div class="dropdown">
|
|
||||||
<select class="selectpicker" id="board_info">
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for bi in board_info_list %}
|
|
||||||
{% if bi==board_info %}
|
|
||||||
<option value="{{bi}}" selected="selected">{{bi}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{bi}}">{{bi}}</option>
|
|
||||||
{% endif%}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<label class="col-sm-1 control-label"> Board name:</label>
|
|
||||||
<text class="col-sm-2 control-label" id="board_type" style="text-align: left;">{{board_type if board_type != None else ''}}</text>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<form action="" enctype="multipart/form-data" method='POST'>
|
|
||||||
<label for="board_info_file" class="custom-file-upload btn btn-primary" id="board_info_file2"
|
|
||||||
style="border: 1px solid #ccc; display: inline-block; padding: 6px 12px;
|
|
||||||
cursor: pointer; border-radius:5px; ">
|
|
||||||
Import Board XML</label>
|
|
||||||
<input type="file" name="file" id="board_info_file" class="col-sm-6 btn btn-primary"
|
|
||||||
style="display: none;">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1"></label>
|
|
||||||
<text class="col-sm-2 control-label" id="bios_info" style="white-space: pre-line">{{bios_info if bios_info != None else ''}}</text>
|
|
||||||
<label class="col-sm-1"></label>
|
|
||||||
<text class="col-sm-2" id="base_board_info" style="white-space: pre-line">{{base_board_info if base_board_info != None else ''}}</text>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<hr class="col-sm-12">
|
|
||||||
|
|
||||||
{% block body_content %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
@ -1,407 +0,0 @@
|
|||||||
{% extends 'base.html' %}
|
|
||||||
|
|
||||||
{% block body_content %}
|
|
||||||
|
|
||||||
<div class="modal fade" id="save_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h4 class="modal-title" id="myModalLabel">Save Launch XML</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="new_launch_name" class="col-sm-3 control-label">Launch XML Name: </label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="new_launch_name"
|
|
||||||
value={{launch}}>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row" id="src_path_row">
|
|
||||||
<label for="src_path" class="col-sm-3 control-label"
|
|
||||||
title="the path to save config xmls; if no path is specified,
|
|
||||||
the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[board]/output and overwirte the previous files.">
|
|
||||||
Launch XML Path: </label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input type="text" class="form-control" id="src_path" value=""
|
|
||||||
placeholder="[acrn-hypervisor]/../user_config/">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" id="remove_launch" class="btn btn-default" data-dismiss="modal">Remove</button>
|
|
||||||
<button type="button" id="save_launch" data-id="" class="btn btn-primary">Submit
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="add_launch_modal" tabindex="-1" role="dialog" aria-labelledby="addlaunchModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h4 class="modal-title" id="addlaunchModalLabel">Configure User VM for Post-launched VM</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="add_launch_type" class="col-sm-3 control-label">VM : </label>
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
<select class="selectpicker" data-width="auto" id="add_launch_type">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="new_launch_name2" class="col-sm-3 control-label">Launch Name : </label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="new_launch_name2"
|
|
||||||
value={{ launch }}>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" id="add_launch_submit" data-id="" class="btn btn-primary" data-dismiss="modal">Submit
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form class="form-horizontal" role="form" method="post">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="old_launch_name" class="col-sm-2 control-label" style="text-align: left;"> Launch
|
|
||||||
Setting:</label>
|
|
||||||
<div class="col-sm-3">
|
|
||||||
<text class="form-control" id="old_launch_name" readonly>{{launch}}</text>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-1 col-sm-offset-1">
|
|
||||||
{% if board_info != None %}
|
|
||||||
<label for="launch_file" class="btn btn-primary" id="scenario_file2"
|
|
||||||
style="border: 1px solid #ccc; display: inline-block; padding: 6px 12px;
|
|
||||||
cursor: pointer; border-radius:5px; ">
|
|
||||||
Import XML</label>
|
|
||||||
<input type="file" name="file" id="launch_file" class="col-sm-1 btn btn-primary" style="display: none;">
|
|
||||||
{% else %}
|
|
||||||
<label class="btn"
|
|
||||||
style="border: 1px solid #ccc; display: inline-block; padding: 6px 12px;
|
|
||||||
cursor: pointer; border-radius:5px; ">
|
|
||||||
Import XML</label>
|
|
||||||
<input type="file" name="file" class="col-sm-1" style="display: none;" disabled>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% if board_info != None and root != None %}
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" class="btn btn-primary" data-id="save" data-toggle="modal" data-target="#save_modal"
|
|
||||||
id="export_launch_xml">Export XML
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" id="generate_launch_script" class="btn btn-primary" data-id="generate_launch_script"
|
|
||||||
data-toggle="modal" data-target="#save_modal">Generate Launch Script
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" disabled class="btn btn-primary">Export XML</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" disabled class="btn btn-primary">Generate Launch Script</button>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="scenario_name" class="col-sm-2 control-label" style="text-align: left;"> Select
|
|
||||||
Scenario:</label>
|
|
||||||
<div class="dropdown col-sm-9">
|
|
||||||
<select class="selectpicker" data-width="auto" id="scenario_name">
|
|
||||||
<option style="display:none">
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for sc in scenarios[1] %}
|
|
||||||
{% if root !=None and root.attrib['scenario'] == sc%}
|
|
||||||
<option value="{{sc}}" selected>{{sc}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{sc}}">{{sc}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if board_info != None and root != None %}
|
|
||||||
<table class="table table-hover" id="tab">
|
|
||||||
{% for vm in root|list %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">User VM: </label>
|
|
||||||
<label class="col-sm-1 control-label" id="vm">{{vm.attrib['id']}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">VM ID: </label>
|
|
||||||
<label class="col-sm-1 control-label" id="vm_id">
|
|
||||||
{{post_launch_vm_list[vm.attrib['id']|int-1][0] if post_launch_vm_list|length>=1 else ''}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<button type="button" class="col-sm-6 btn" id="add_launch_vm" data-id="{{vm.attrib['id']}}" data-toggle="modal"
|
|
||||||
data-target="#add_launch_modal">Configure a User VM below</button>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<button type="button" class="col-sm-6 btn" id="remove_launch_vm" data-id="{{vm.attrib['id']}}">
|
|
||||||
Remove this VM</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% for elem in vm|list %}
|
|
||||||
{% if elem|list == [] and ('configurable' not in elem.attrib or elem.attrib['configurable'] !=
|
|
||||||
'0') %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}">{{elem.tag}}</label>
|
|
||||||
<label class="col-sm-2 control-label"></label>
|
|
||||||
{% set elem_text = '' if elem.text == None else elem.text %}
|
|
||||||
{% if ','.join(['user_vm', elem.tag]) not in launch_item_values %}
|
|
||||||
<div class="col-sm-6">
|
|
||||||
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
|
|
||||||
{% if elem.tag == 'kernel_cmdline' %}
|
|
||||||
<textarea type="text" class="form-control"
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag}}" readonly>{{elem_text}}</textarea>
|
|
||||||
{% else %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag}}" value="{{elem_text}}" readonly/>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{% if elem.tag == 'kernel_cmdline' %}
|
|
||||||
<textarea type="text" class="form-control" style="height:120px"
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag}}">{{elem_text}}</textarea>
|
|
||||||
{% else %}
|
|
||||||
<input type="text" class="form-control" value="{{elem_text}}"
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag}}"/>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
|
|
||||||
<select class="selectpicker" data-width="auto" title="" disabled
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag}}">
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto" title=""
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag}}">
|
|
||||||
{% endif %}
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for item_value in launch_item_values[','.join(['user_vm', elem.tag])] %}
|
|
||||||
{% if item_value == elem_text %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<p id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag}}_err" class="col-sm-3"></p>
|
|
||||||
</div>
|
|
||||||
{% elif elem|list != [] %}
|
|
||||||
{% if 'multiselect' not in elem.attrib or elem.attrib['multiselect'] != 'true' %}
|
|
||||||
{% set first_multi_child = {'block': 0, 'network': 0, 'input': 0, 'pcpu_id': 0, 'shm_region': 0,
|
|
||||||
'passthrough_devices': 0, 'virtio_devices': 0, 'sriov_devices': 0, 'communication_vuart': 0} %}
|
|
||||||
{% for sub_elem in elem|list %}
|
|
||||||
{% set sub_elem_text = '' if sub_elem.text == None else sub_elem.text %}
|
|
||||||
{% if 'configurable' not in sub_elem.attrib or sub_elem.attrib['configurable'] != '0' %}
|
|
||||||
<div class="form-group">
|
|
||||||
{% if 'id' not in elem.attrib %}
|
|
||||||
{% if elem.tag in first_multi_child.keys() and first_multi_child[elem.tag] == 0 %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
|
||||||
{{elem.tag}}</label>
|
|
||||||
{% do first_multi_child.update({elem.tag: first_multi_child[elem.tag]+1}) %}
|
|
||||||
{% elif sub_elem.tag in ['pcpu_id', 'shm_region', 'communication_vuart'] and first_multi_child[sub_elem.tag] == 0 %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
|
||||||
{{elem.tag}}</label>
|
|
||||||
{% else %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
|
||||||
</label>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
|
||||||
{{sub_elem.tag}}</label>
|
|
||||||
|
|
||||||
{% if ','.join(['user_vm', elem.tag, sub_elem.tag]) not in launch_item_values
|
|
||||||
and elem.tag not in ['cpu_affinity', 'shm_regions', 'communication_vuarts']%}
|
|
||||||
<div class="col-sm-5">
|
|
||||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
|
||||||
<input type="text" class="form-control" readonly
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}"
|
|
||||||
value="{{sub_elem_text}}">
|
|
||||||
{% else %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}"
|
|
||||||
value="{{sub_elem_text}}">
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if elem.tag in ['virtio_devices'] and sub_elem.tag in ['block', 'network', 'input'] %}
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" class="btn" id="add_virtio_{{sub_elem.tag}}_{{first_multi_child[sub_elem.tag]}}">+</button>
|
|
||||||
{% if first_multi_child[sub_elem.tag] == 0 %}
|
|
||||||
<button type="button" disabled class="btn" id="remove_virtio_{{sub_elem.tag}}_{{first_multi_child[sub_elem.tag]}}">-</button>
|
|
||||||
{% else %}
|
|
||||||
<button type="button" class="btn" id="remove_virtio_{{sub_elem.tag}}_{{first_multi_child[sub_elem.tag]}}">-</button>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% do first_multi_child.update({sub_elem.tag: first_multi_child[sub_elem.tag]+1}) %}
|
|
||||||
{% endif%}
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
{% if elem.tag == 'cpu_affinity' %}
|
|
||||||
{% set item_key = ','.join(['user_vm', elem.tag]) %}
|
|
||||||
{% elif elem.tag in ['shm_regions', 'communication_vuarts'] %}
|
|
||||||
{% set item_key = ','.join(['user_vm:id='+vm.attrib['id'], elem.tag, sub_elem.tag]) %}
|
|
||||||
{% else %}
|
|
||||||
{% set item_key = ','.join(['user_vm', elem.tag, sub_elem.tag]) %}
|
|
||||||
{% endif %}
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
|
||||||
<select class="selectpicker" data-width="auto" disabled
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">
|
|
||||||
{% endif %}
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for item_value in launch_item_values[item_key] %}
|
|
||||||
{% if item_value == sub_elem_text %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
{% if elem.tag in ['cpu_affinity', 'shm_regions', 'communication_vuarts'] %}
|
|
||||||
<button type="button" class="btn" id="add_shm_{{first_multi_child[sub_elem.tag]}}">+</button>
|
|
||||||
{% if not first_multi_child[sub_elem.tag] %}
|
|
||||||
<button type="button" disabled class="btn" id="remove_shm_{{first_multi_child[sub_elem.tag]}}">-</button>
|
|
||||||
{% else %}
|
|
||||||
<button type="button" class="btn" id="remove_shm_{{first_multi_child[sub_elem.tag]}}">-</button>
|
|
||||||
{% endif %}
|
|
||||||
{% do first_multi_child.update({sub_elem.tag: first_multi_child[sub_elem.tag]+1}) %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<p id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}_err" class="col-sm-3"></p>
|
|
||||||
{% else %}
|
|
||||||
{% if elem.tag in first_multi_child.keys() and first_multi_child[elem.tag] == 0 %}
|
|
||||||
{% do first_multi_child.update({elem.tag: first_multi_child[elem.tag]+1}) %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
|
||||||
{{elem.tag+' '+elem.attrib['id']}}</label>
|
|
||||||
{% else %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
|
||||||
</label>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
|
||||||
{{sub_elem.tag}}</label>
|
|
||||||
|
|
||||||
{% if ','.join(['user_vm', elem.tag, sub_elem.tag]) not in launch_item_values %}
|
|
||||||
<div class="col-sm-6">
|
|
||||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
|
||||||
<input type="text" class="form-control" readonly
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
|
|
||||||
value="{{sub_elem_text}}">
|
|
||||||
{% else %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
|
|
||||||
value="{{sub_elem_text}}">
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
|
||||||
<select class="selectpicker" data-width="auto" disabled
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
|
|
||||||
{% endif %}
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for item_value in launch_item_values[','.join(['user_vm', elem.tag, sub_elem.tag])] %}
|
|
||||||
{% if item_value == sub_elem_text %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<p id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_err"
|
|
||||||
class="col-sm-3"></p>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% elif 'configurable' not in elem.attrib or elem.attrib['configurable'] != '0' %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}">{{elem.tag}}</label>
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
|
||||||
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}"></label>
|
|
||||||
<div class="dropdown col-sm-9">
|
|
||||||
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
|
|
||||||
<select class="selectpicker" data-width="auto" disabled
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}" multiple>
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto" disabled
|
|
||||||
id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}" multiple>
|
|
||||||
{% endif %}
|
|
||||||
{% if ','.join(['user_vm', elem.tag]) not in launch_item_values %}
|
|
||||||
{% set x=1 %}
|
|
||||||
{% for sub_elem in elem|list %}
|
|
||||||
<option value="{{sub_elem.text}}" selected="selected">{{sub_elem.text}}</option>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
{% set selected_list = [] %}
|
|
||||||
{% for sub_elem in elem|list %}
|
|
||||||
{% do selected_list.append(sub_elem.text) %}
|
|
||||||
{% endfor %}
|
|
||||||
{% for item_value in launch_item_values[','.join(['user_vm', elem.tag])] %}
|
|
||||||
{% if item_value in selected_list %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<p id="{{'user_vm:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}_err" class="col-sm-3"></p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
<tr><td>
|
|
||||||
<button type="button" class="btn" id="add_launch_script" data-toggle="modal" data-id="-1"
|
|
||||||
data-target="#add_launch_modal">Configure a User VM</button>
|
|
||||||
</td></tr>
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<text class="form-control" id="err_msg">No setting available. Select one board info and make sure the launch xml
|
|
||||||
exists.
|
|
||||||
</text>
|
|
||||||
{% endif %}
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,482 +0,0 @@
|
|||||||
{% extends 'base.html' %}
|
|
||||||
|
|
||||||
{% block body_content %}
|
|
||||||
|
|
||||||
<div class="modal fade" id="save_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h4 class="modal-title" id="myModalLabel">Save Scenario XML</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="new_scenario_name" class="col-sm-3 control-label">Scenario XML Name: </label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="new_scenario_name"
|
|
||||||
value={{ scenario }}>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row" id="src_path_row">
|
|
||||||
<label for="src_path" class="col-sm-3 control-label"
|
|
||||||
title="the path to save config xmls; if no path is specified,
|
|
||||||
the source files will be generated into default path and overwirte the previous files.">
|
|
||||||
Scenario XML Path: </label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input type="text" class="form-control" id="src_path" value=""
|
|
||||||
placeholder="[acrn-hypervisor]/../user_config/">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" id="remove_scenario" class="btn btn-default" data-dismiss="modal">Remove</button>
|
|
||||||
<button type="button" id="save_scenario" data-id="" class="btn btn-primary">Submit
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="add_vm_modal" tabindex="-1" role="dialog" aria-labelledby="addVMModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h4 class="modal-title" id="addVMModalLabel">Add a new VM</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="add_vm_type" class="col-sm-3 control-label">VM type: </label>
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
<select class="selectpicker" data-width="auto" id="add_vm_type">
|
|
||||||
<option value="PRE_STD_VM">PRE_STD_VM</option>
|
|
||||||
<option value="PRE_RT_VM">PRE_RT_VM</option>
|
|
||||||
<option value="SAFETY_VM">SAFETY_VM</option>
|
|
||||||
<option value="SERVICE_VM">SERVICE_VM</option>
|
|
||||||
<option value="POST_STD_VM">POST_STD_VM</option>
|
|
||||||
<option value="POST_RT_VM">POST_RT_VM</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="new_scenario_name2" class="col-sm-3 control-label">Scenario Name: </label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="new_scenario_name2"
|
|
||||||
value={{ scenario }}>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" id="add_vm_submit" data-id="" class="btn btn-primary" data-dismiss="modal">Submit
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form class="form-horizontal" role="form" method="post">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="old_scenario_name" class="col-sm-2 control-label" style="text-align: left;"> Scenario
|
|
||||||
Setting:</label>
|
|
||||||
<div class="col-sm-3">
|
|
||||||
<text class="form-control" id="old_scenario_name" readonly>{{scenario}}</text>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-1 col-sm-offset-1">
|
|
||||||
{% if board_info != None %}
|
|
||||||
<label for="scenario_file" class="btn btn-primary" id="scenario_file2"
|
|
||||||
style="border: 1px solid #ccc; display: inline-block; padding: 6px 12px;
|
|
||||||
cursor: pointer; border-radius:5px; ">
|
|
||||||
Import XML</label>
|
|
||||||
<input type="file" name="file" id="scenario_file" class="col-sm-1 btn btn-primary" style="display: none;">
|
|
||||||
{% else %}
|
|
||||||
<label for="scenario_file" class="btn"
|
|
||||||
style="border: 1px solid #ccc; display: inline-block; padding: 6px 12px;
|
|
||||||
cursor: pointer; border-radius:5px; ">
|
|
||||||
Import XML</label>
|
|
||||||
<input type="file" name="file" class="col-sm-1" style="display: none;" disabled>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% if board_info != None and root != None and scenario_item_values %}
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" data-id="" class="btn btn-primary" data-toggle="modal" data-target="#save_modal"
|
|
||||||
id="export_scenario_xml">Export XML
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" disabled class="btn btn-primary" data-toggle="modal" data-target="#save_modal">Export XML
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if board_info != None and root != None and scenario_item_values %}
|
|
||||||
<table class="table table-hover" id="tab">
|
|
||||||
{% for vm in root|list %}
|
|
||||||
{% set first_multi_child = {'IVSHMEM_REGION': 0, 'communication_vuart': 1} %}
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag])]['configurable'] == 'y' or
|
|
||||||
vm.xpath(xpath_dict['/'.join(['/acrn-config', vm.tag])]['configurable'])%}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{% if vm.tag != 'vm' %}
|
|
||||||
{% set vm_type = 'hv' %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label">HV </label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<button type="button" class="btn" id="add_vm" data-id="-1" data-toggle="modal"
|
|
||||||
data-target="#add_vm_modal">Add a VM below</button>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
{% set vm_type = 'vm:id='+vm.attrib['id'] %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label">VM: </label>
|
|
||||||
<label class="col-sm-1 control-label" id="vm">{{vm.attrib['id']}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<button type="button" class="btn" id="add_vm" data-id="{{vm.attrib['id']}}" data-toggle="modal"
|
|
||||||
data-target="#add_vm_modal">Add a VM below</button>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<button type="button" class="btn" id="remove_vm" data-id="{{vm.attrib['id']}}">
|
|
||||||
Remove this VM</button>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% for elem in vm|list %}
|
|
||||||
{% set elem_text = elem.text if elem.text != None else '' %}
|
|
||||||
{% if elem|list == [] and (xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['configurable']
|
|
||||||
== 'y' or elem.xpath(xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['configurable']))%}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['doc']}}">{{elem.tag}}</label>
|
|
||||||
<label class="col-sm-2 control-label"></label>
|
|
||||||
|
|
||||||
{% if ','.join([vm.tag, elem.tag]) not in scenario_item_values %}
|
|
||||||
<div class="col-sm-6">
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['readonly'] == 'y' %}
|
|
||||||
<input type="text" class="form-control" id="{{vm_type+','+elem.tag}}"
|
|
||||||
value="{{elem_text}}" readonly>
|
|
||||||
{% else %}
|
|
||||||
<input type="text" class="form-control" id="{{vm_type+','+elem.tag}}"
|
|
||||||
value="{{elem_text}}">
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['readonly'] == 'y' %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{vm_type+','+elem.tag}}" disabled>
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{vm_type+','+elem.tag}}">
|
|
||||||
{% endif %}
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for item_value in scenario_item_values[','.join([vm.tag, elem.tag])] %}
|
|
||||||
{% if item_value == elem_text %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<p id="{{vm_type+','+elem.tag}}_err" class="col-sm-3"></p>
|
|
||||||
</div>
|
|
||||||
{% elif elem|list != [] and (xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['configurable']
|
|
||||||
== 'y' or elem.xpath(xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['configurable']))%}
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['multiselect'] != 'y' %}
|
|
||||||
{% set first_child = [] %}
|
|
||||||
{% for sub_elem in elem|list %}
|
|
||||||
{% set sub_elem_text = sub_elem.text if sub_elem.text != None else '' %}
|
|
||||||
|
|
||||||
{% if sub_elem.tag in ['RDT', 'IVSHMEM', 'SSRAM'] %}
|
|
||||||
{% for sub_elem_2 in sub_elem|list %}
|
|
||||||
{% set sub_elem_2_text = sub_elem_2.text if sub_elem_2.text != None else '' %}
|
|
||||||
{% if ','.join([vm.tag, elem.tag, sub_elem.tag, sub_elem_2.tag]) in scenario_item_values %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['doc']}}">
|
|
||||||
</label>
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag, sub_elem_2.tag])]['doc']}}">
|
|
||||||
{{sub_elem.tag}} {{sub_elem_2.tag}}</label>
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag, sub_elem_2.tag])]['readonly'] == 'y' %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}" disabled>
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}">
|
|
||||||
{% endif %}
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for item_value in scenario_item_values[vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag] %}
|
|
||||||
{% if item_value == sub_elem_2.text %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<p id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}_err" class="col-sm-3"></p>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['doc']}}">
|
|
||||||
</label>
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag, sub_elem_2.tag])]['doc']}}">
|
|
||||||
{{sub_elem.tag}} {{sub_elem_2.tag}}</label>
|
|
||||||
{% if sub_elem_2.tag in ['IVSHMEM_REGION'] %}
|
|
||||||
<div class="col-sm-5">
|
|
||||||
{% else %}
|
|
||||||
<div class="col-sm-6">
|
|
||||||
{% endif %}
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag, sub_elem_2.tag])]['readonly'] == 'y' %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}"
|
|
||||||
readonly vaule="{{sub_elem_2_text}}"></input>
|
|
||||||
{% else %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}" value="{{sub_elem_2_text}}"></input>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% if sub_elem_2.tag in ['IVSHMEM_REGION'] %}
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" class="btn" id="add_ivshmem_{{sub_elem.tag}}_{{first_multi_child[sub_elem_2.tag]}}">+</button>
|
|
||||||
{% if first_multi_child[sub_elem_2.tag] == 0 %}
|
|
||||||
<button type="button" disabled class="btn" id="remove_ivshmem_{{sub_elem.tag}}_{{first_multi_child[sub_elem_2.tag]}}">-</button>
|
|
||||||
{% else %}
|
|
||||||
<button type="button" class="btn" id="remove_ivshmem_{{sub_elem.tag}}_{{first_multi_child[sub_elem_2.tag]}}">-</button>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% do first_multi_child.update({sub_elem_2.tag: first_multi_child[sub_elem_2.tag]+1}) %}
|
|
||||||
{% endif%}
|
|
||||||
{% if sub_elem_2.tag in ['IVSHMEM_REGION'] %}
|
|
||||||
<p id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag+','+(first_multi_child[sub_elem_2.tag]-1)|string()}}_err" class="col-sm-3"></p>
|
|
||||||
{% else %}
|
|
||||||
<p id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}_err" class="col-sm-3"></p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['configurable'] == 'y' or
|
|
||||||
sub_elem.xpath(xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['configurable'])%}
|
|
||||||
<div class="form-group">
|
|
||||||
{% if 'id' not in elem.attrib %}
|
|
||||||
{% if not first_child %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['doc']}}">
|
|
||||||
{{elem.tag}}</label>
|
|
||||||
{% else %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip">
|
|
||||||
</label>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['doc']}}">
|
|
||||||
{{sub_elem.tag}}</label>
|
|
||||||
|
|
||||||
{% if ','.join([vm.tag, elem.tag, sub_elem.tag]) not in scenario_item_values
|
|
||||||
and elem.tag != 'cpu_affinity' and elem.tag != 'pci_devs' %}
|
|
||||||
{% if sub_elem.tag in ['bootargs', 'kern_args'] %}
|
|
||||||
<div class="col-sm-6">
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['readonly'] == 'y' %}
|
|
||||||
<textarea type="text" class="form-control" style="height:120px"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}"
|
|
||||||
readonly>{{sub_elem_text}}</textarea>
|
|
||||||
{% else %}
|
|
||||||
<textarea type="text" class="form-control" style="height:120px"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}">{{sub_elem_text}}</textarea>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="col-sm-6">
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['readonly'] == 'y' %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}"
|
|
||||||
value="{{sub_elem_text}}" readonly>
|
|
||||||
{% else %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}"
|
|
||||||
value="{{sub_elem_text}}">
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{% set item_key = ','.join([vm.tag, elem.tag, sub_elem.tag]) if elem.tag != 'cpu_affinity'
|
|
||||||
and elem.tag != 'pci_devs' else ','.join([vm.tag, elem.tag]) %}
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['readonly'] == 'y' %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}" disabled>
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}">
|
|
||||||
{% endif %}
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for item_value in scenario_item_values[item_key] %}
|
|
||||||
{% if item_value == sub_elem_text %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
{% if elem.tag == 'cpu_affinity' %}
|
|
||||||
<button type="button" class="btn" id="add_vcpu_{{first_child|length}}">+</button>
|
|
||||||
{% if not first_child %}
|
|
||||||
<button type="button" disabled class="btn" id="remove_vcpu_{{first_child|length}}">-</button>
|
|
||||||
{% else %}
|
|
||||||
<button type="button" class="btn" id="remove_vcpu_{{first_child|length}}">-</button>
|
|
||||||
{% endif %}
|
|
||||||
{% elif elem.tag == 'pci_devs' %}
|
|
||||||
<button type="button" class="btn" id="add_pci_dev_{{first_child|length}}">+</button>
|
|
||||||
{% if not first_child %}
|
|
||||||
<button type="button" disabled class="btn" id="remove_pci_dev_{{first_child|length}}">-</button>
|
|
||||||
{% else %}
|
|
||||||
<button type="button" class="btn" id="remove_pci_dev_{{first_child|length}}">-</button>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{% endif%}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% do first_child.append(1) %}
|
|
||||||
<p id="{{vm_type+','+elem.tag+','+sub_elem.tag}}_err" class="col-sm-3"></p>
|
|
||||||
{% else %}
|
|
||||||
{% if not first_child %}
|
|
||||||
{% do first_child.append(1) %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label1"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['doc']}}">
|
|
||||||
{{elem.tag+' '+elem.attrib['id']}}</label>
|
|
||||||
{% else %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label1">
|
|
||||||
</label>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
|
||||||
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label2"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['doc']}}">
|
|
||||||
{{sub_elem.tag}}</label>
|
|
||||||
{% if (','.join([vm.tag, elem.tag, sub_elem.tag]) not in scenario_item_values) and
|
|
||||||
((elem.tag!='vuart' and elem.tag!='legacy_vuart') or sub_elem.tag!='base') %}
|
|
||||||
<div class="col-sm-6"
|
|
||||||
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_config">
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['readonly'] == 'y' %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
|
|
||||||
value="{{sub_elem_text}}" readonly>
|
|
||||||
{% else %}
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
|
|
||||||
value="{{sub_elem_text}}">
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag, sub_elem.tag])]['readonly'] == 'y' %}
|
|
||||||
<select class="selectpicker" data-width="auto" disabled
|
|
||||||
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
|
|
||||||
{% endif %}
|
|
||||||
{% set key = ('vm='+vm.attrib['id']+','+elem.tag+'='+elem.attrib['id']+','+sub_elem.tag)
|
|
||||||
if (elem.tag in ['vuart', 'legacy_vuart'] and sub_elem.tag=='base')
|
|
||||||
else ','.join([vm.tag, elem.tag, sub_elem.tag]) %}
|
|
||||||
<option disabled selected value> -- Select an option -- </option>
|
|
||||||
{% for item_value in scenario_item_values[key] %}
|
|
||||||
{% if item_value == sub_elem_text %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
{% if elem.tag in ['communication_vuart'] and sub_elem.tag in ['base'] %}
|
|
||||||
<button type="button" class="btn" id="add_{{elem.tag}}_{{first_multi_child[elem.tag]}}">+</button>
|
|
||||||
{% if first_multi_child[elem.tag] == 1 %}
|
|
||||||
<button type="button" disabled class="btn" id="remove_{{elem.tag}}_{{first_multi_child[elem.tag]}}">-</button>
|
|
||||||
{% else %}
|
|
||||||
<button type="button" class="btn" id="remove_{{elem.tag}}_{{first_multi_child[elem.tag]}}">-</button>
|
|
||||||
{% endif %}
|
|
||||||
{% do first_multi_child.update({elem.tag: first_multi_child[elem.tag]+1}) %}
|
|
||||||
{% endif%}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<p id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_err"
|
|
||||||
class="col-sm-3"></p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% elif xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['configurable'] == 'y' or
|
|
||||||
elem.xpath(xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['configurable'])%}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
|
||||||
title="{{xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['doc']}}">{{elem.tag}}</label>
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"></label>
|
|
||||||
<div class="dropdown col-sm-6">
|
|
||||||
{% if xpath_dict['/'.join(['/acrn-config', vm.tag, elem.tag])]['readonly'] == 'y' %}
|
|
||||||
<select class="selectpicker" data-width="auto" disabled
|
|
||||||
id="{{vm_type+','+elem.tag+','+elem.tag[:-1]}}"
|
|
||||||
multiple>
|
|
||||||
{% else %}
|
|
||||||
<select class="selectpicker" data-width="auto"
|
|
||||||
id="{{vm_type+','+elem.tag+','+elem.tag[:-1]}}"
|
|
||||||
multiple>
|
|
||||||
{% endif %}
|
|
||||||
{% if ','.join([vm.tag, elem.tag]) not in scenario_item_values %}
|
|
||||||
{% set x=1 %}
|
|
||||||
{% for sub_elem in elem|list %}
|
|
||||||
<option value="{{sub_elem.text}}" selected="selected">{{sub_elem.text}}</option>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
{% set selected_list = [] %}
|
|
||||||
{% for sub_elem in elem|list %}
|
|
||||||
{% do selected_list.append(sub_elem.text) %}
|
|
||||||
{% endfor %}
|
|
||||||
{% for item_value in scenario_item_values[','.join([vm.tag, elem.tag])] %}
|
|
||||||
{% if item_value in selected_list %}
|
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{item_value}}">{{item_value}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<p id="{{vm_type+','+elem.tag+','+elem.tag[:-1]}}_err" class="col-sm-3"></p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<text class="form-control" id="err_msg">No setting available. Select one board info and make sure the scenario xml
|
|
||||||
exists.
|
|
||||||
</text>
|
|
||||||
{% endif %}
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user